diff --git a/dist/3.x/mat3-impl.d.ts b/dist/3.x/mat3-impl.d.ts index d87b1dc..b3d28b7 100644 --- a/dist/3.x/mat3-impl.d.ts +++ b/dist/3.x/mat3-impl.d.ts @@ -25,12 +25,13 @@ export declare function getAPI(Ctor: Mat3Ctor< getAxis: (m: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_13 | undefined) => T_13; getScaling: (m: BaseArgType, dst?: T_14 | undefined) => T | T_14; - translation: (v: BaseArgType, dst?: T_15 | undefined) => T_15; - translate: (m: BaseArgType, v: BaseArgType, dst?: T_16 | undefined) => T_16; - rotation: (angleInRadians: number, dst?: T_17 | undefined) => T_17; - rotate: (m: BaseArgType, angleInRadians: number, dst?: T_18 | undefined) => T_18; - scaling: (v: BaseArgType, dst?: T_19 | undefined) => T_19; - scale: (m: BaseArgType, v: BaseArgType, dst?: T_20 | undefined) => T_20; - uniformScaling: (s: number, dst?: T_21 | undefined) => T_21; - uniformScale: (m: BaseArgType, s: number, dst?: T_22 | undefined) => T_22; + get3DScaling: (m: BaseArgType, dst?: T_15 | undefined) => T | T_15; + translation: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_17 | undefined) => T_17; + rotation: (angleInRadians: number, dst?: T_18 | undefined) => T_18; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_19 | undefined) => T_19; + scaling: (v: BaseArgType, dst?: T_20 | undefined) => T_20; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_21 | undefined) => T_21; + uniformScaling: (s: number, dst?: T_22 | undefined) => T_22; + uniformScale: (m: BaseArgType, s: number, dst?: T_23 | undefined) => T_23; }; diff --git a/dist/3.x/wgpu-matrix.d.ts b/dist/3.x/wgpu-matrix.d.ts index 84dc9d7..5e6bafe 100644 --- a/dist/3.x/wgpu-matrix.d.ts +++ b/dist/3.x/wgpu-matrix.d.ts @@ -57,14 +57,15 @@ mat3: { getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; getScaling: (m: BaseArgType, dst?: T_13 | undefined) => Float32Array | T_13; - translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; - translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; - rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; - rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; - scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; - scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; - uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; - uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; + get3DScaling: (m: BaseArgType, dst?: T_14 | undefined) => Float32Array | T_14; + translation: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_16 | undefined) => T_16; + rotation: (angleInRadians: number, dst?: T_17 | undefined) => T_17; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_18 | undefined) => T_18; + scaling: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_20 | undefined) => T_20; + uniformScaling: (s: number, dst?: T_21 | undefined) => T_21; + uniformScale: (m: BaseArgType, s: number, dst?: T_22 | undefined) => T_22; }, /** * 4x4 Matrix functions that default to returning `Float32Array` @@ -351,14 +352,15 @@ export declare const mat3d: { getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; getScaling: (m: BaseArgType, dst?: T_13 | undefined) => Float64Array | T_13; - translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; - translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; - rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; - rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; - scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; - scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; - uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; - uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; + get3DScaling: (m: BaseArgType, dst?: T_14 | undefined) => Float64Array | T_14; + translation: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_16 | undefined) => T_16; + rotation: (angleInRadians: number, dst?: T_17 | undefined) => T_17; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_18 | undefined) => T_18; + scaling: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_20 | undefined) => T_20; + uniformScaling: (s: number, dst?: T_21 | undefined) => T_21; + uniformScale: (m: BaseArgType, s: number, dst?: T_22 | undefined) => T_22; }, mat4d: { create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => Float64Array; set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T | undefined) => T; @@ -620,14 +622,15 @@ export declare const mat3n: { getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; getScaling: (m: BaseArgType, dst?: T_13 | undefined) => number[] | T_13; - translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; - translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; - rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; - rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; - scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; - scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; - uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; - uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; + get3DScaling: (m: BaseArgType, dst?: T_14 | undefined) => number[] | T_14; + translation: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_16 | undefined) => T_16; + rotation: (angleInRadians: number, dst?: T_17 | undefined) => T_17; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_18 | undefined) => T_18; + scaling: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_20 | undefined) => T_20; + uniformScaling: (s: number, dst?: T_21 | undefined) => T_21; + uniformScale: (m: BaseArgType, s: number, dst?: T_22 | undefined) => T_22; }, mat4n: { create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => number[]; set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T | undefined) => T; diff --git a/dist/3.x/wgpu-matrix.js b/dist/3.x/wgpu-matrix.js index 7f24dbe..b05791c 100644 --- a/dist/3.x/wgpu-matrix.js +++ b/dist/3.x/wgpu-matrix.js @@ -1,4 +1,4 @@ -/* wgpu-matrix@3.0.3, license MIT */ +/* wgpu-matrix@3.1.0, license MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -830,1405 +830,1378 @@ * DEALINGS IN THE SOFTWARE. */ /** - * Generates a typed API for Mat3 + * Generates am typed API for Vec3 * */ function getAPIImpl$4(Ctor) { - const vec2 = getAPI$5(Ctor); /** - * Create a Mat3 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat3's specified type - * it would be faster to use - * - * ``` - * const m = mat3.clone(someJSArray); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @returns matrix created from values. + * Creates a vec3; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector */ - function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { - const newDst = new Ctor(12); - // to make the array homogenous - newDst[3] = 0; - newDst[7] = 0; - newDst[11] = 0; - if (v0 !== undefined) { - newDst[0] = v0; - if (v1 !== undefined) { - newDst[1] = v1; - if (v2 !== undefined) { - newDst[2] = v2; - if (v3 !== undefined) { - newDst[4] = v3; - if (v4 !== undefined) { - newDst[5] = v4; - if (v5 !== undefined) { - newDst[6] = v5; - if (v6 !== undefined) { - newDst[8] = v6; - if (v7 !== undefined) { - newDst[9] = v7; - if (v8 !== undefined) { - newDst[10] = v8; - } - } - } - } - } - } + function create(x, y, z) { + const newDst = new Ctor(3); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; } } } return newDst; } /** - * Sets the values of a Mat3 - * Also see {@link mat3.create} and {@link mat3.copy} + * Creates a vec3; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Vec3 + * Also see {@link vec3.create} and {@link vec3.copy} * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 set from values. + * @param x first value + * @param y second value + * @param z third value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. */ - function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = v0; - newDst[1] = v1; - newDst[2] = v2; - newDst[3] = 0; - newDst[4] = v3; - newDst[5] = v4; - newDst[6] = v5; - newDst[7] = 0; - newDst[8] = v6; - newDst[9] = v7; - newDst[10] = v8; - newDst[11] = 0; + function set(x, y, z, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; return newDst; } /** - * Creates a Mat3 from the upper left 3x3 part of a Mat4 - * @param m4 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from m4 + * Applies Math.ceil to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the ceil of each element of v. */ - function fromMat4(m4, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = m4[0]; - newDst[1] = m4[1]; - newDst[2] = m4[2]; - newDst[3] = 0; - newDst[4] = m4[4]; - newDst[5] = m4[5]; - newDst[6] = m4[6]; - newDst[7] = 0; - newDst[8] = m4[8]; - newDst[9] = m4[9]; - newDst[10] = m4[10]; - newDst[11] = 0; + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); return newDst; } /** - * Creates a Mat3 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from q + * Applies Math.floor to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the floor of each element of v. */ - function fromQuat(q, dst) { - const newDst = (dst ?? new Ctor(12)); - const x = q[0]; - const y = q[1]; - const z = q[2]; - const w = q[3]; - const x2 = x + x; - const y2 = y + y; - const z2 = z + z; - const xx = x * x2; - const yx = y * x2; - const yy = y * y2; - const zx = z * x2; - const zy = z * y2; - const zz = z * z2; - const wx = w * x2; - const wy = w * y2; - const wz = w * z2; - newDst[0] = 1 - yy - zz; - newDst[1] = yx + wz; - newDst[2] = zx - wy; - newDst[3] = 0; - newDst[4] = yx - wz; - newDst[5] = 1 - xx - zz; - newDst[6] = zy + wx; - newDst[7] = 0; - newDst[8] = zx + wy; - newDst[9] = zy - wx; - newDst[10] = 1 - xx - yy; - newDst[11] = 0; + function floor(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); return newDst; } /** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. + * Applies Math.round to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the round of each element of v. */ - function negate(m, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = -m[0]; - newDst[1] = -m[1]; - newDst[2] = -m[2]; - newDst[4] = -m[4]; - newDst[5] = -m[5]; - newDst[6] = -m[6]; - newDst[8] = -m[8]; - newDst[9] = -m[9]; - newDst[10] = -m[10]; + function round(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); return newDst; } /** - * Copies a matrix. (same as {@link mat3.clone}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. + * Clamp each element of vector between min and max + * @param v - Operand vector. + * @param max - Min value, default 0 + * @param min - Max value, default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that the clamped value of each element of v. */ - function copy(m, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = m[0]; - newDst[1] = m[1]; - newDst[2] = m[2]; - newDst[4] = m[4]; - newDst[5] = m[5]; - newDst[6] = m[6]; - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); return newDst; } /** - * Copies a matrix (same as {@link mat3.copy}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. + * Adds two vectors; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a and b. */ - const clone = copy; + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + return newDst; + } /** - * Check if 2 matrices are approximately equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are approximately equal + * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param scale - Amount to scale b + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a + b * scale. + */ + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + return newDst; + } + /** + * Returns the angle in radians between two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns The angle in radians between the 2 vectors. + */ + function angle(a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); + const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); + const mag = mag1 * mag2; + const cosine = mag && dot(a, b) / mag; + return Math.acos(cosine); + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + const sub = subtract; + /** + * Check if 2 vectors are approximately equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are approximately equal */ function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[4] - b[4]) < EPSILON && - Math.abs(a[5] - b[5]) < EPSILON && - Math.abs(a[6] - b[6]) < EPSILON && - Math.abs(a[8] - b[8]) < EPSILON && - Math.abs(a[9] - b[9]) < EPSILON && - Math.abs(a[10] - b[10]) < EPSILON; + Math.abs(a[2] - b[2]) < EPSILON; } /** - * Check if 2 matrices are exactly equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are exactly equal + * Check if 2 vectors are exactly equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are exactly equal */ function equals(a, b) { - return a[0] === b[0] && - a[1] === b[1] && - a[2] === b[2] && - a[4] === b[4] && - a[5] === b[5] && - a[6] === b[6] && - a[8] === b[8] && - a[9] === b[9] && - a[10] === b[10]; + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } /** - * Creates a 3-by-3 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 3-by-3 identity matrix. + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficient. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. */ - function identity(dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = 1; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = 1; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); return newDst; } /** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient vector t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficients vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns the linear interpolated result. */ - function transpose(m, dst) { - const newDst = (dst ?? new Ctor(12)); - if (newDst === m) { - let t; - // 0 1 2 - // 4 5 6 - // 8 9 10 - t = m[1]; - m[1] = m[4]; - m[4] = t; - t = m[2]; - m[2] = m[8]; - m[8] = t; - t = m[6]; - m[6] = m[9]; - m[9] = t; - return newDst; - } - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - newDst[0] = m00; - newDst[1] = m10; - newDst[2] = m20; - newDst[4] = m01; - newDst[5] = m11; - newDst[6] = m21; - newDst[8] = m02; - newDst[9] = m12; - newDst[10] = m22; + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); return newDst; } /** - * Computes the inverse of a 3-by-3 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. + * Return max values of two vectors. + * Given vectors a and b returns + * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The max components vector. */ - function inverse(m, dst) { - const newDst = (dst ?? new Ctor(12)); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const b01 = m22 * m11 - m12 * m21; - const b11 = -m22 * m10 + m12 * m20; - const b21 = m21 * m10 - m11 * m20; - const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); - newDst[0] = b01 * invDet; - newDst[1] = (-m22 * m01 + m02 * m21) * invDet; - newDst[2] = (m12 * m01 - m02 * m11) * invDet; - newDst[4] = b11 * invDet; - newDst[5] = (m22 * m00 - m02 * m20) * invDet; - newDst[6] = (-m12 * m00 + m02 * m10) * invDet; - newDst[8] = b21 * invDet; - newDst[9] = (-m21 * m00 + m01 * m20) * invDet; - newDst[10] = (m11 * m00 - m01 * m10) * invDet; + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); return newDst; } /** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant + * Return min values of two vectors. + * Given vectors a and b returns + * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The min components vector. */ - function determinant(m) { - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - return m00 * (m11 * m22 - m21 * m12) - - m10 * (m01 * m22 - m21 * m02) + - m20 * (m01 * m12 - m11 * m02); + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + return newDst; } /** - * Computes the inverse of a 3-by-3 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. + * Multiplies a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - const invert = inverse; + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + return newDst; + } /** - * Multiplies two 3-by-3 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ - function multiply(a, b, dst) { - const newDst = (dst ?? new Ctor(12)); - const a00 = a[0]; - const a01 = a[1]; - const a02 = a[2]; - const a10 = a[4 + 0]; - const a11 = a[4 + 1]; - const a12 = a[4 + 2]; - const a20 = a[8 + 0]; - const a21 = a[8 + 1]; - const a22 = a[8 + 2]; - const b00 = b[0]; - const b01 = b[1]; - const b02 = b[2]; - const b10 = b[4 + 0]; - const b11 = b[4 + 1]; - const b12 = b[4 + 2]; - const b20 = b[8 + 0]; - const b21 = b[8 + 1]; - const b22 = b[8 + 2]; - newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; - newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; - newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; - newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; - newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; - newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; - newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; - newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; - newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; - return newDst; - } - /** - * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. + * Multiplies a vector by a scalar. (same as mulScalar) + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - const mul = multiply; + const scale = mulScalar; /** - * Sets the translation component of a 3-by-3 matrix to the given - * vector. - * @param a - The matrix. + * Divides a vector by a scalar. * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - function setTranslation(a, v, dst) { - const newDst = (dst ?? identity()); - if (a !== newDst) { - newDst[0] = a[0]; - newDst[1] = a[1]; - newDst[2] = a[2]; - newDst[4] = a[4]; - newDst[5] = a[5]; - newDst[6] = a[6]; - } - newDst[8] = v[0]; - newDst[9] = v[1]; - newDst[10] = 1; + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; return newDst; } /** - * Returns the translation component of a 3-by-3 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. + * Inverse a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. */ - function getTranslation(m, dst) { - const newDst = (dst ?? vec2.create()); - newDst[0] = m[8]; - newDst[1] = m[9]; + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; return newDst; } /** - * Returns an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, - * @returns The axis component of m. + * Invert a vector. (same as inverse) + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. */ - function getAxis(m, axis, dst) { - const newDst = (dst ?? vec2.create()); - const off = axis * 4; - newDst[0] = m[off + 0]; - newDst[1] = m[off + 1]; - return newDst; - } + const invert = inverse; /** - * Sets an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. + * Computes the cross product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of a cross b. */ - function setAxis(m, v, axis, dst) { - const newDst = (dst === m ? m : copy(m, dst)); - const off = axis * 4; - newDst[off + 0] = v[0]; - newDst[off + 1] = v[1]; - return newDst; - } - ///** - // * Returns the scaling component of the matrix - // * @param m - The Matrix - // * @param dst - The vector to set. If not passed a new one is created. - // */ - function getScaling(m, dst) { - const newDst = (dst ?? vec2.create()); - const xx = m[0]; - const xy = m[1]; - const yx = m[4]; - const yy = m[5]; - newDst[0] = Math.sqrt(xx * xx + xy * xy); - newDst[1] = Math.sqrt(yx * yx + yy * yy); + function cross(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + const t1 = a[2] * b[0] - a[0] * b[2]; + const t2 = a[0] * b[1] - a[1] * b[0]; + newDst[0] = a[1] * b[2] - a[2] * b[1]; + newDst[1] = t1; + newDst[2] = t2; return newDst; } /** - * Creates a 3-by-3 matrix which translates by the given vector v. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. + * Computes the dot product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns dot product */ - function translation(v, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = 1; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = 1; - newDst[6] = 0; - newDst[8] = v[0]; - newDst[9] = v[1]; - newDst[10] = 1; - return newDst; + function dot(a, b) { + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); } /** - * Translates the given 3-by-3 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. + * Computes the length of vector + * @param v - vector. + * @returns length of vector. */ - function translate(m, v, dst) { - const newDst = (dst ?? new Ctor(12)); + function length(v) { const v0 = v[0]; const v1 = v[1]; - const m00 = m[0]; - const m01 = m[1]; - const m02 = m[2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - if (m !== newDst) { - newDst[0] = m00; - newDst[1] = m01; - newDst[2] = m02; - newDst[4] = m10; - newDst[5] = m11; - newDst[6] = m12; - } - newDst[8] = m00 * v0 + m10 * v1 + m20; - newDst[9] = m01 * v0 + m11 * v1 + m21; - newDst[10] = m02 * v0 + m12 * v1 + m22; - return newDst; + const v2 = v[2]; + return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); } /** - * Creates a 3-by-3 matrix which rotates by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. + * Computes the length of vector (same as length) + * @param v - vector. + * @returns length of vector. */ - function rotation(angleInRadians, dst) { - const newDst = (dst ?? new Ctor(12)); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - newDst[0] = c; - newDst[1] = s; - newDst[2] = 0; - newDst[4] = -s; - newDst[5] = c; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + const len = length; + /** + * Computes the square of the length of vector + * @param v - vector. + * @returns square of the length of vector. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + return v0 * v0 + v1 * v1 + v2 * v2; } /** - * Rotates the given 3-by-3 matrix by the given angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. + * Computes the square of the length of vector (same as lengthSq) + * @param v - vector. + * @returns square of the length of vector. */ - function rotate(m, angleInRadians, dst) { - const newDst = (dst ?? new Ctor(12)); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - newDst[0] = c * m00 + s * m10; - newDst[1] = c * m01 + s * m11; - newDst[2] = c * m02 + s * m12; - newDst[4] = c * m10 - s * m00; - newDst[5] = c * m11 - s * m01; - newDst[6] = c * m12 - s * m02; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } + const lenSq = lengthSq; /** - * Creates a 3-by-3 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * 2 entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. + * Computes the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns distance between a and b */ - function scaling(v, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = v[0]; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = v[1]; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + function distance(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return Math.sqrt(dx * dx + dy * dy + dz * dz); } /** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of 2 entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. + * Computes the distance between 2 points (same as distance) + * @param a - vector. + * @param b - vector. + * @returns distance between a and b */ - function scale(m, v, dst) { - const newDst = (dst ?? new Ctor(12)); - const v0 = v[0]; - const v1 = v[1]; - newDst[0] = v0 * m[0 * 4 + 0]; - newDst[1] = v0 * m[0 * 4 + 1]; - newDst[2] = v0 * m[0 * 4 + 2]; - newDst[4] = v1 * m[1 * 4 + 0]; - newDst[5] = v1 * m[1 * 4 + 1]; - newDst[6] = v1 * m[1 * 4 + 2]; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } + const dist = distance; /** - * Creates a 3-by-3 matrix which scales uniformly in each dimension - * @param s - Amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. + * Computes the square of the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b */ - function uniformScaling(s, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = s; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = s; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + function distanceSq(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return dx * dx + dy * dy + dz * dz; } /** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given. - * @param m - The matrix to be modified. - * @param s - Amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. + * Computes the square of the distance between 2 points (same as distanceSq) + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b */ - function uniformScale(m, s, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = s * m[0 * 4 + 0]; - newDst[1] = s * m[0 * 4 + 1]; - newDst[2] = s * m[0 * 4 + 2]; - newDst[4] = s * m[1 * 4 + 0]; - newDst[5] = s * m[1 * 4 + 1]; - newDst[6] = s * m[1 * 4 + 2]; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } - return { - clone, - create, - set, - fromMat4, - fromQuat, - negate, - copy, - equalsApproximately, - equals, - identity, - transpose, - inverse, - invert, - determinant, - mul, - multiply, - setTranslation, - getTranslation, - getAxis, - setAxis, - getScaling, - translation, - translate, - rotation, - rotate, - scaling, - scale, - uniformScaling, - uniformScale, - }; - } - const cache$4 = new Map(); - function getAPI$4(Ctor) { - let api = cache$4.get(Ctor); - if (!api) { - api = getAPIImpl$4(Ctor); - cache$4.set(Ctor, api); - } - return api; - } - - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * Generates am typed API for Vec3 - * */ - function getAPIImpl$3(Ctor) { + const distSq = distanceSq; /** - * Creates a vec3; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector + * Divides a vector by its Euclidean length and returns the quotient. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The normalized vector. */ - function create(x, y, z) { - const newDst = new Ctor(3); - if (x !== undefined) { - newDst[0] = x; - if (y !== undefined) { - newDst[1] = y; - if (z !== undefined) { - newDst[2] = z; - } - } + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(3)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; } return newDst; } /** - * Creates a vec3; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ - const fromValues = create; - /** - * Sets the values of a Vec3 - * Also see {@link vec3.create} and {@link vec3.copy} - * - * @param x first value - * @param y second value - * @param z third value + * Negates a vector. + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. + * @returns -v. */ - function set(x, y, z, dst) { + function negate(v, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = x; - newDst[1] = y; - newDst[2] = z; + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; return newDst; } /** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. + * Copies a vector. (same as {@link vec3.clone}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. + * @returns A copy of v. */ - function ceil(v, dst) { + function copy(v, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.ceil(v[0]); - newDst[1] = Math.ceil(v[1]); - newDst[2] = Math.ceil(v[2]); - return newDst; - } - /** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ - function floor(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.floor(v[0]); - newDst[1] = Math.floor(v[1]); - newDst[2] = Math.floor(v[2]); - return newDst; - } - /** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ - function round(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.round(v[0]); - newDst[1] = Math.round(v[1]); - newDst[2] = Math.round(v[2]); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; return newDst; } /** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 + * Clones a vector. (same as {@link vec3.copy}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. + * @returns A copy of v. */ - function clamp(v, min = 0, max = 1, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.min(max, Math.max(min, v[0])); - newDst[1] = Math.min(max, Math.max(min, v[1])); - newDst[2] = Math.min(max, Math.max(min, v[2])); - return newDst; - } + const clone = copy; /** - * Adds two vectors; assumes a and b have the same dimension. + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. + * @returns The vector of products of entries of a and b. */ - function add(a, b, dst) { + function multiply(a, b, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + b[0]; - newDst[1] = a[1] + b[1]; - newDst[2] = a[2] + b[2]; + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; return newDst; } /** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. (same as mul) * @param a - Operand vector. * @param b - Operand vector. - * @param scale - Amount to scale b * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ - function addScaled(a, b, scale, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + b[0] * scale; - newDst[1] = a[1] + b[1] * scale; - newDst[2] = a[2] + b[2] * scale; - return newDst; - } - /** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. + * @returns The vector of products of entries of a and b. */ - function angle(a, b) { - const ax = a[0]; - const ay = a[1]; - const az = a[2]; - const bx = b[0]; - const by = b[1]; - const bz = b[2]; - const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); - const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); - const mag = mag1 * mag2; - const cosine = mag && dot(a, b) / mag; - return Math.acos(cosine); - } + const mul = multiply; /** - * Subtracts two vectors. + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. + * @returns The vector of quotients of entries of a and b. */ - function subtract(a, b, dst) { + function divide(a, b, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] - b[0]; - newDst[1] = a[1] - b[1]; - newDst[2] = a[2] - b[2]; + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; return newDst; } /** - * Subtracts two vectors. + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. (same as divide) * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ - const sub = subtract; - /** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ - function equalsApproximately(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON; - } - /** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal + * @returns The vector of quotients of entries of a and b. */ - function equals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; - } + const div = divide; /** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. + * Creates a random vector + * @param scale - Default 1 * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. + * @returns The random vector. */ - function lerp(a, b, t, dst) { + function random(scale = 1, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + t * (b[0] - a[0]); - newDst[1] = a[1] + t * (b[1] - a[1]); - newDst[2] = a[2] + t * (b[2] - a[2]); + const angle = Math.random() * 2 * Math.PI; + const z = Math.random() * 2 - 1; + const zScale = Math.sqrt(1 - z * z) * scale; + newDst[0] = Math.cos(angle) * zScale; + newDst[1] = Math.sin(angle) * zScale; + newDst[2] = z * scale; return newDst; } /** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. + * Zero's a vector * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. + * @returns The zeroed vector. */ - function lerpV(a, b, t, dst) { + function zero(dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + t[0] * (b[0] - a[0]); - newDst[1] = a[1] + t[1] * (b[1] - a[1]); - newDst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; return newDst; } /** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. + * transform vec3 by 4x4 matrix + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector */ - function max(a, b, dst) { + function transformMat4(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.max(a[0], b[0]); - newDst[1] = Math.max(a[1], b[1]); - newDst[2] = Math.max(a[2], b[2]); + const x = v[0]; + const y = v[1]; + const z = v[2]; + const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; + newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return newDst; } /** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. + * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. + * @param v - The direction. + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns The transformed vector. */ - function min(a, b, dst) { + function transformMat4Upper3x3(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.min(a[0], b[0]); - newDst[1] = Math.min(a[1], b[1]); - newDst[2] = Math.min(a[2], b[2]); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; return newDst; } /** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. + * Transforms vec3 by 3x3 matrix + * + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector */ - function mulScalar(v, k, dst) { + function transformMat3(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0] * k; - newDst[1] = v[1] * k; - newDst[2] = v[2] * k; + const x = v[0]; + const y = v[1]; + const z = v[2]; + newDst[0] = x * m[0] + y * m[4] + z * m[8]; + newDst[1] = x * m[1] + y * m[5] + z * m[9]; + newDst[2] = x * m[2] + y * m[6] + z * m[10]; return newDst; } /** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. + * Transforms vec3 by Quaternion + * @param v - the vector to transform + * @param q - the quaternion to transform by + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed */ - const scale = mulScalar; - /** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ - function divScalar(v, k, dst) { + function transformQuat(v, q, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0] / k; - newDst[1] = v[1] / k; - newDst[2] = v[2] / k; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = v[0]; + const y = v[1]; + const z = v[2]; + const uvX = qy * z - qz * y; + const uvY = qz * x - qx * z; + const uvZ = qx * y - qy * x; + newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; + newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; + newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; return newDst; } /** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. + * Returns the translation component of a 4-by-4 matrix as a vector with 3 + * entries. + * @param m - The matrix. + * @param dst - vector to hold result. If not passed a new one is created. + * @returns The translation component of m. */ - function inverse(v, dst) { + function getTranslation(m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = 1 / v[0]; - newDst[1] = 1 / v[1]; - newDst[2] = 1 / v[2]; + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; return newDst; } /** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. + * Returns an axis of a 4x4 matrix as a vector with 3 entries + * @param m - The matrix. + * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @returns The axis component of m. */ - const invert = inverse; + function getAxis(m, axis, dst) { + const newDst = (dst ?? new Ctor(3)); + const off = axis * 4; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; + } /** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. + * Returns the scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. */ - function cross(a, b, dst) { + function getScaling(m, dst) { const newDst = (dst ?? new Ctor(3)); - const t1 = a[2] * b[0] - a[0] * b[2]; - const t2 = a[0] * b[1] - a[1] * b[0]; - newDst[0] = a[1] * b[2] - a[2] * b[1]; - newDst[1] = t1; - newDst[2] = t2; + const xx = m[0]; + const xy = m[1]; + const xz = m[2]; + const yx = m[4]; + const yy = m[5]; + const yz = m[6]; + const zx = m[8]; + const zy = m[9]; + const zz = m[10]; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); return newDst; } /** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product + * Rotate a 3D vector around the x-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector */ - function dot(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); + function rotateX(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + //Translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + //perform rotation + r[0] = p[0]; + r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); + r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); + //translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. + * Rotate a 3D vector around the y-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector */ - function length(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + function rotateY(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); + r[1] = p[1]; + r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. + * Rotate a 3D vector around the z-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns {vec3} out */ - const len = length; + function rotateZ(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); + r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); + r[2] = p[2]; + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; + } /** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. + * Treat a 3D vector as a direction and set it's length + * + * @param a The vec3 to lengthen + * @param len The length of the resulting vector + * @returns The lengthened vector */ - function lengthSq(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return v0 * v0 + v1 * v1 + v2 * v2; + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(3)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. + * Ensure a vector is not longer than a max length + * + * @param a The vec3 to limit + * @param maxLen The longest length of the resulting vector + * @returns The vector, shortened to maxLen if it's too long */ - const lenSq = lengthSq; + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(3)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); + } + return copy(a, newDst); + } /** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b + * Return the vector exactly between 2 endpoint vectors + * + * @param a Endpoint 1 + * @param b Endpoint 2 + * @returns The vector exactly residing between endpoints 1 and 2 */ - function distance(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return Math.sqrt(dx * dx + dy * dy + dz * dz); + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + return lerp(a, b, 0.5, newDst); } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat4Upper3x3, + transformMat3, + transformQuat, + getTranslation, + getAxis, + getScaling, + rotateX, + rotateY, + rotateZ, + setLength, + truncate, + midpoint, + }; + } + const cache$4 = new Map(); + function getAPI$4(Ctor) { + let api = cache$4.get(Ctor); + if (!api) { + api = getAPIImpl$4(Ctor); + cache$4.set(Ctor, api); + } + return api; + } + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates a typed API for Mat3 + * */ + function getAPIImpl$3(Ctor) { + const vec2 = getAPI$5(Ctor); + const vec3 = getAPI$4(Ctor); /** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b + * Create a Mat3 from values + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Mat3's specified type + * it would be faster to use + * + * ``` + * const m = mat3.clone(someJSArray); + * ``` + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @returns matrix created from values. */ - const dist = distance; + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { + const newDst = new Ctor(12); + // to make the array homogenous + newDst[3] = 0; + newDst[7] = 0; + newDst[11] = 0; + if (v0 !== undefined) { + newDst[0] = v0; + if (v1 !== undefined) { + newDst[1] = v1; + if (v2 !== undefined) { + newDst[2] = v2; + if (v3 !== undefined) { + newDst[4] = v3; + if (v4 !== undefined) { + newDst[5] = v4; + if (v5 !== undefined) { + newDst[6] = v5; + if (v6 !== undefined) { + newDst[8] = v6; + if (v7 !== undefined) { + newDst[9] = v7; + if (v8 !== undefined) { + newDst[10] = v8; + } + } + } + } + } + } + } + } + } + return newDst; + } /** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b + * Sets the values of a Mat3 + * Also see {@link mat3.create} and {@link mat3.copy} + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 set from values. */ - function distanceSq(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return dx * dx + dy * dy + dz * dz; + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = 0; + newDst[4] = v3; + newDst[5] = v4; + newDst[6] = v5; + newDst[7] = 0; + newDst[8] = v6; + newDst[9] = v7; + newDst[10] = v8; + newDst[11] = 0; + return newDst; } /** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b + * Creates a Mat3 from the upper left 3x3 part of a Mat4 + * @param m4 - source matrix + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from m4 */ - const distSq = distanceSq; + function fromMat4(m4, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m4[0]; + newDst[1] = m4[1]; + newDst[2] = m4[2]; + newDst[3] = 0; + newDst[4] = m4[4]; + newDst[5] = m4[5]; + newDst[6] = m4[6]; + newDst[7] = 0; + newDst[8] = m4[8]; + newDst[9] = m4[9]; + newDst[10] = m4[10]; + newDst[11] = 0; + return newDst; + } /** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. + * Creates a Mat3 rotation matrix from a quaternion + * @param q - quaternion to create matrix from + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from q */ - function normalize(v, dst) { - const newDst = (dst ?? new Ctor(3)); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); - if (len > 0.00001) { - newDst[0] = v0 / len; - newDst[1] = v1 / len; - newDst[2] = v2 / len; - } - else { - newDst[0] = 0; - newDst[1] = 0; - newDst[2] = 0; - } + function fromQuat(q, dst) { + const newDst = (dst ?? new Ctor(12)); + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const yx = y * x2; + const yy = y * y2; + const zx = z * x2; + const zy = z * y2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; return newDst; } /** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. + * Negates a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns -m. */ - function negate(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = -v[0]; - newDst[1] = -v[1]; - newDst[2] = -v[2]; + function negate(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; return newDst; } /** - * Copies a vector. (same as {@link vec3.clone}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. + * Copies a matrix. (same as {@link mat3.clone}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. */ - function copy(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0]; - newDst[1] = v[1]; - newDst[2] = v[2]; + function copy(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; return newDst; } /** - * Clones a vector. (same as {@link vec3.copy}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. + * Copies a matrix (same as {@link mat3.copy}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. */ const clone = copy; /** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. + * Check if 2 matrices are approximately equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are approximately equal */ - function multiply(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] * b[0]; - newDst[1] = a[1] * b[1]; - newDst[2] = a[2] * b[2]; - return newDst; + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[4] - b[4]) < EPSILON && + Math.abs(a[5] - b[5]) < EPSILON && + Math.abs(a[6] - b[6]) < EPSILON && + Math.abs(a[8] - b[8]) < EPSILON && + Math.abs(a[9] - b[9]) < EPSILON && + Math.abs(a[10] - b[10]) < EPSILON; } /** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. + * Check if 2 matrices are exactly equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are exactly equal */ - const mul = multiply; + function equals(a, b) { + return a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[8] === b[8] && + a[9] === b[9] && + a[10] === b[10]; + } /** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. + * Creates a 3-by-3 identity matrix. + * + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A 3-by-3 identity matrix. */ - function divide(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] / b[0]; - newDst[1] = a[1] / b[1]; - newDst[2] = a[2] / b[2]; + function identity(dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ - const div = divide; - /** - * Creates a random vector - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. + * Takes the transpose of a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The transpose of m. */ - function random(scale = 1, dst) { - const newDst = (dst ?? new Ctor(3)); - const angle = Math.random() * 2 * Math.PI; - const z = Math.random() * 2 - 1; - const zScale = Math.sqrt(1 - z * z) * scale; - newDst[0] = Math.cos(angle) * zScale; - newDst[1] = Math.sin(angle) * zScale; - newDst[2] = z * scale; + function transpose(m, dst) { + const newDst = (dst ?? new Ctor(12)); + if (newDst === m) { + let t; + // 0 1 2 + // 4 5 6 + // 8 9 10 + t = m[1]; + m[1] = m[4]; + m[4] = t; + t = m[2]; + m[2] = m[8]; + m[8] = t; + t = m[6]; + m[6] = m[9]; + m[9] = t; + return newDst; + } + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; return newDst; } /** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. + * Computes the inverse of a 3-by-3 matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. */ - function zero(dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = 0; - newDst[1] = 0; - newDst[2] = 0; + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const b01 = m22 * m11 - m12 * m21; + const b11 = -m22 * m10 + m12 * m20; + const b21 = m21 * m10 - m11 * m20; + const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); + newDst[0] = b01 * invDet; + newDst[1] = (-m22 * m01 + m02 * m21) * invDet; + newDst[2] = (m12 * m01 - m02 * m11) * invDet; + newDst[4] = b11 * invDet; + newDst[5] = (m22 * m00 - m02 * m20) * invDet; + newDst[6] = (-m12 * m00 + m02 * m10) * invDet; + newDst[8] = b21 * invDet; + newDst[9] = (-m21 * m00 + m01 * m20) * invDet; + newDst[10] = (m11 * m00 - m01 * m10) * invDet; return newDst; } /** - * transform vec3 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector + * Compute the determinant of a matrix + * @param m - the matrix + * @returns the determinant */ - function transformMat4(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const x = v[0]; - const y = v[1]; - const z = v[2]; - const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; - newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return newDst; + function determinant(m) { + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + return m00 * (m11 * m22 - m21 * m12) - + m10 * (m01 * m22 - m21 * m02) + + m20 * (m01 * m12 - m11 * m02); } /** - * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. - * @param v - The direction. + * Computes the inverse of a 3-by-3 matrix. (same as inverse) * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns The transformed vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. */ - function transformMat4Upper3x3(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; - newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; - newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; - return newDst; - } + const invert = inverse; /** - * Transforms vec3 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector + * Multiplies two 3-by-3 matrices with a on the left and b on the right + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. */ - function transformMat3(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const x = v[0]; - const y = v[1]; - const z = v[2]; - newDst[0] = x * m[0] + y * m[4] + z * m[8]; - newDst[1] = x * m[1] + y * m[5] + z * m[9]; - newDst[2] = x * m[2] + y * m[6] + z * m[10]; + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(12)); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[4 + 0]; + const a11 = a[4 + 1]; + const a12 = a[4 + 2]; + const a20 = a[8 + 0]; + const a21 = a[8 + 1]; + const a22 = a[8 + 2]; + const b00 = b[0]; + const b01 = b[1]; + const b02 = b[2]; + const b10 = b[4 + 0]; + const b11 = b[4 + 1]; + const b12 = b[4 + 2]; + const b20 = b[8 + 0]; + const b21 = b[8 + 1]; + const b22 = b[8 + 2]; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; return newDst; } /** - * Transforms vec3 by Quaternion - * @param v - the vector to transform - * @param q - the quaternion to transform by - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed + * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. */ - function transformQuat(v, q, dst) { - const newDst = (dst ?? new Ctor(3)); - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const w2 = q[3] * 2; - const x = v[0]; - const y = v[1]; - const z = v[2]; - const uvX = qy * z - qz * y; - const uvY = qz * x - qx * z; - const uvZ = qx * y - qy * x; - newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; - newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; - newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; + const mul = multiply; + /** + * Sets the translation component of a 3-by-3 matrix to the given + * vector. + * @param a - The matrix. + * @param v - The vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix with translation set. + */ + function setTranslation(a, v, dst) { + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; + } + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; return newDst; } /** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 + * Returns the translation component of a 3-by-3 matrix as a vector with 3 * entries. * @param m - The matrix. * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ function getTranslation(m, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = m[12]; - newDst[1] = m[13]; - newDst[2] = m[14]; + const newDst = (dst ?? vec2.create()); + newDst[0] = m[8]; + newDst[1] = m[9]; return newDst; } /** - * Returns an axis of a 4x4 matrix as a vector with 3 entries + * Returns an axis of a 3x3 matrix as a vector with 2 entries * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @param axis - The axis 0 = x, 1 = y, * @returns The axis component of m. */ function getAxis(m, axis, dst) { - const newDst = (dst ?? new Ctor(3)); + const newDst = (dst ?? vec2.create()); const off = axis * 4; newDst[0] = m[off + 0]; newDst[1] = m[off + 1]; - newDst[2] = m[off + 2]; return newDst; } /** - * Returns the scaling component of the matrix + * Sets an axis of a 3x3 matrix as a vector with 2 entries + * @param m - The matrix. + * @param v - the axis vector + * @param axis - The axis 0 = x, 1 = y; + * @param dst - The matrix to set. If not passed a new one is created. + * @returns The matrix with axis set. + */ + function setAxis(m, v, axis, dst) { + const newDst = (dst === m ? m : copy(m, dst)); + const off = axis * 4; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + return newDst; + } + /** + * Returns the "2d" scaling component of the matrix * @param m - The Matrix * @param dst - The vector to set. If not passed a new one is created. */ function getScaling(m, dst) { - const newDst = (dst ?? new Ctor(3)); + const newDst = (dst ?? vec2.create()); + const xx = m[0]; + const xy = m[1]; + const yx = m[4]; + const yy = m[5]; + newDst[0] = Math.sqrt(xx * xx + xy * xy); + newDst[1] = Math.sqrt(yx * yx + yy * yy); + return newDst; + } + /** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ + function get3DScaling(m, dst) { + const newDst = (dst ?? vec3.create()); const xx = m[0]; const xy = m[1]; const xz = m[2]; @@ -2244,180 +2217,230 @@ return newDst; } /** - * Rotate a 3D vector around the x-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector + * Creates a 3-by-3 matrix which translates by the given vector v. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translation matrix. */ - function rotateX(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); - //translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function translation(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; + } + /** + * Translates the given 3-by-3 matrix by the given vector v. + * @param m - The matrix. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translated matrix. + */ + function translate(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + const m00 = m[0]; + const m01 = m[1]; + const m02 = m[2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; + } + newDst[8] = m00 * v0 + m10 * v1 + m20; + newDst[9] = m01 * v0 + m11 * v1 + m21; + newDst[10] = m02 * v0 + m12 * v1 + m22; + return newDst; + } + /** + * Creates a 3-by-3 matrix which rotates by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotation(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Rotate a 3D vector around the y-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector + * Rotates the given 3-by-3 matrix by the given angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. */ - function rotateY(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); - // translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function rotate(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } return newDst; } /** - * Rotate a 3D vector around the z-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns {vec3} out + * Creates a 3-by-3 matrix which scales in each dimension by an amount given by + * the corresponding entry in the given vector; assumes the vector has three + * entries. + * @param v - A vector of + * 2 entries specifying the factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. */ - function rotateZ(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; - // translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function scaling(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Treat a 3D vector as a direction and set it's length - * - * @param a The vec3 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector + * Scales the given 3-by-3 matrix in each dimension by an amount + * given by the corresponding entry in the given vector; assumes the vector has + * three entries. + * @param m - The matrix to be modified. + * @param v - A vector of 2 entries specifying the + * factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. */ - function setLength(a, len, dst) { - const newDst = (dst ?? new Ctor(3)); - normalize(a, newDst); - return mulScalar(newDst, len, newDst); + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; } /** - * Ensure a vector is not longer than a max length - * - * @param a The vec3 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long + * Creates a 3-by-3 matrix which scales uniformly in each dimension + * @param s - Amount to scale + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. */ - function truncate(a, maxLen, dst) { - const newDst = (dst ?? new Ctor(3)); - if (length(a) > maxLen) { - return setLength(a, maxLen, newDst); - } - return copy(a, newDst); + function uniformScaling(s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 + * Scales the given 3-by-3 matrix in each dimension by an amount + * given. + * @param m - The matrix to be modified. + * @param s - Amount to scale. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. */ - function midpoint(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - return lerp(a, b, 0.5, newDst); + function uniformScale(m, s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; } return { + clone, create, - fromValues, set, - ceil, - floor, - round, - clamp, - add, - addScaled, - angle, - subtract, - sub, + fromMat4, + fromQuat, + negate, + copy, equalsApproximately, equals, - lerp, - lerpV, - max, - min, - mulScalar, - scale, - divScalar, + identity, + transpose, inverse, invert, - cross, - dot, - length, - len, - lengthSq, - lenSq, - distance, - dist, - distanceSq, - distSq, - normalize, - negate, - copy, - clone, - multiply, + determinant, mul, - divide, - div, - random, - zero, - transformMat4, - transformMat4Upper3x3, - transformMat3, - transformQuat, + multiply, + setTranslation, getTranslation, getAxis, + setAxis, getScaling, - rotateX, - rotateY, - rotateZ, - setLength, - truncate, - midpoint, + get3DScaling, + translation, + translate, + rotation, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, }; } const cache$3 = new Map(); @@ -2434,7 +2457,7 @@ * Generates a typed API for Mat4 * */ function getAPIImpl$2(Ctor) { - const vec3 = getAPI$3(Ctor); + const vec3 = getAPI$4(Ctor); /** * 4x4 Matrix math math functions. * @@ -3129,11 +3152,11 @@ newDst[off + 2] = v[2]; return newDst; } - ///** - // * Returns the scaling component of the matrix - // * @param m - The Matrix - // * @param dst - The vector to set. If not passed a new one is created. - // */ + /** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ function getScaling(m, dst) { const newDst = (dst ?? vec3.create()); const xx = m[0]; @@ -4099,7 +4122,7 @@ * Generates am typed API for Qud * */ function getAPIImpl$1(Ctor) { - const vec3 = getAPI$3(Ctor); + const vec3 = getAPI$4(Ctor); /** * Creates a quat4; may be called with x, y, z to set initial values. * @param x - Initial x value. @@ -5547,7 +5570,7 @@ function wgpuMatrixAPI(Mat3Ctor, Mat4Ctor, QuatCtor, Vec2Ctor, Vec3Ctor, Vec4Ctor) { return { /** @namespace mat3 */ - mat3: getAPI$4(Mat3Ctor), + mat3: getAPI$3(Mat3Ctor), /** @namespace mat4 */ mat4: getAPI$2(Mat4Ctor), /** @namespace quat */ @@ -5555,7 +5578,7 @@ /** @namespace vec2 */ vec2: getAPI$5(Vec2Ctor), /** @namespace vec3 */ - vec3: getAPI$3(Vec3Ctor), + vec3: getAPI$4(Vec3Ctor), /** @namespace vec4 */ vec4: getAPI(Vec4Ctor), }; diff --git a/dist/3.x/wgpu-matrix.js.map b/dist/3.x/wgpu-matrix.js.map index b371929..8d5f7ce 100644 --- a/dist/3.x/wgpu-matrix.js.map +++ b/dist/3.x/wgpu-matrix.js.map @@ -1 +1 @@ -{"version":3,"file":"wgpu-matrix.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat3API","getMat4API","getQuatAPI","getVec4API"],"mappings":";;;;;;;IAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;QAE7C,OAAO,cAAc,mBAAmB,CAAA;IACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;IACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;gBACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;aACnC;IACG,KAAA,CAAC;IACT,CAAC;IAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;IClBvE;;;;;;;;;;;;;;;;;;;;IAoBG;IAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;IAE9B;;;;IAIG;IACG,SAAU,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H,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE;AAE3E,UAAA;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"wgpu-matrix.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/vec3-impl.ts","../../../src/mat3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n const vec3 = getVec3API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n/**\n * Returns the \"2d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction get3DScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec3.create());\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n get3DScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat3API","getMat4API","getQuatAPI","getVec4API"],"mappings":";;;;;;;IAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;QAE7C,OAAO,cAAc,mBAAmB,CAAA;IACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;IACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;gBACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;aACnC;IACG,KAAA,CAAC;IACT,CAAC;IAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;IClBvE;;;;;;;;;;;;;;;;;;;;IAoBG;IAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;IAE9B;;;;IAIG;IACG,SAAU,UAAU,CAAC,CAAS,EAAA;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC;QACpB,OAAO,GAAG,CAAC,CAAC;IACZ,IAAA,OAAO,G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I,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE;AAE3E,UAAA;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK;IACX;;;IAGG;IACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/3.x/wgpu-matrix.min.js b/dist/3.x/wgpu-matrix.min.js index 34a7a24..46565a0 100644 --- a/dist/3.x/wgpu-matrix.min.js +++ b/dist/3.x/wgpu-matrix.min.js @@ -1,2 +1,2 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).wgpuMatrix={})}(this,(function(n){"use strict";const t=(e=Array,r=n=>n.fill(0),class extends e{constructor(...n){super(...n),r(this)}});var e,r;let o=1e-6;var c={__proto__:null,get EPSILON(){return o},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,e){const r=t-n;return Math.abs(t-n)1e-5?(r[0]=o/u,r[1]=c/u):(r[0]=0,r[1]=0),r}function l(t,e){const r=e??new n(2);return r[0]=t[0],r[1]=t[1],r}function w(t,e,r){const o=r??new n(2);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o}function m(t,e,r){const o=r??new n(2);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o}function d(t,e,r){const o=r??new n(2);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r){const o=r??new n(2);return o[0]=t,o[1]=e,o},ceil:function(t,e){const r=e??new n(2);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r},floor:function(t,e){const r=e??new n(2);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r},round:function(t,e){const r=e??new n(2);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(2);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c},add:function(t,e,r){const o=r??new n(2);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o},addScaled:function(t,e,r,o){const c=o??new n(2);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=t[0],c=t[1],u=Math.sqrt(e*e+r*r)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(2))}}}(n),u.set(n,t)),t}const s=new Map;function i(n){let t=s.get(n);return t||(t=function(n){const t=a(n);function e(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[8]=t[8],r[9]=t[9],r[10]=t[10],r}function r(t){const e=t??new n(12);return e[0]=1,e[1]=0,e[2]=0,e[4]=0,e[5]=1,e[6]=0,e[8]=0,e[9]=0,e[10]=1,e}function c(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],h=t[9],M=t[10],l=M*s-i*h,w=-M*a+i*f,m=h*a-s*f,d=1/(o*l+c*w+u*m);return r[0]=l*d,r[1]=(-M*c+u*h)*d,r[2]=(i*c-u*s)*d,r[4]=w*d,r[5]=(M*o-u*f)*d,r[6]=(-i*o+u*a)*d,r[8]=m*d,r[9]=(-h*o+c*f)*d,r[10]=(s*o-c*a)*d,r}function u(t,e,r){const o=r??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],h=t[8],M=t[9],l=t[10],w=e[0],m=e[1],d=e[2],v=e[4],p=e[5],q=e[6],b=e[8],g=e[9],x=e[10];return o[0]=c*w+s*m+h*d,o[1]=u*w+i*m+M*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*p+h*q,o[5]=u*v+i*p+M*q,o[6]=a*v+f*p+l*q,o[8]=c*b+s*g+h*x,o[9]=u*b+i*g+M*x,o[10]=a*b+f*g+l*x,o}return{clone:e,create:function(t,e,r,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==e&&(f[1]=e,void 0!==r&&(f[2]=r,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,e,r,o,c,u,a,s,i,f){const h=f??new n(12);return h[0]=t,h[1]=e,h[2]=r,h[3]=0,h[4]=o,h[5]=c,h[6]=u,h[7]=0,h[8]=a,h[9]=s,h[10]=i,h[11]=0,h},fromMat4:function(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=0,r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=0,r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=0,r},fromQuat:function(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,h=o*s,M=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return r[0]=1-l-d,r[1]=M+q,r[2]=w-p,r[3]=0,r[4]=M-q,r[5]=1-h-d,r[6]=m+v,r[7]=0,r[8]=w+p,r[9]=m-v,r[10]=1-h-l,r[11]=0,r},negate:function(t,e){const r=e??new n(12);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r},copy:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])1e-5?(r[0]=o/a,r[1]=c/a,r[2]=u/a):(r[0]=0,r[1]=0,r[2]=0),r}function l(t,e){const r=e??new n(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function w(t,e,r){const o=r??new n(3);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o}function m(t,e,r){const o=r??new n(3);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o}function d(t,e,r){const o=r??new n(3);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o){const c=o??new n(3);return c[0]=t,c[1]=e,c[2]=r,c},ceil:function(t,e){const r=e??new n(3);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r},floor:function(t,e){const r=e??new n(3);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r},round:function(t,e){const r=e??new n(3);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(3);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c},add:function(t,e,r){const o=r??new n(3);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o},addScaled:function(t,e,r,o){const c=o??new n(3);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(3))}}}(n),f.set(n,t)),t}const M=new Map;function l(n){let t=M.get(n);return t||(t=function(n){const t=h(n);function e(t,e){const r=e??new n(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}const r=e;function c(t){const e=t??new n(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u(t,e){const r=e??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=t[4],i=t[5],f=t[6],h=t[7],M=t[8],l=t[9],w=t[10],m=t[11],d=t[12],v=t[13],p=t[14],q=t[15],b=w*q,g=p*m,x=f*q,y=p*h,A=f*m,S=w*h,z=u*q,F=p*a,T=u*m,k=w*a,I=u*h,P=f*a,V=M*v,Z=d*l,L=s*v,R=d*i,E=s*l,X=M*i,Y=o*v,_=d*c,Q=o*l,j=M*c,N=o*i,U=s*c,D=b*i+y*l+A*v-(g*i+x*l+S*v),O=g*c+z*l+k*v-(b*c+F*l+T*v),$=x*c+F*i+I*v-(y*c+z*i+P*v),B=S*c+T*i+P*l-(A*c+k*i+I*l),C=1/(o*D+s*O+M*$+d*B);return r[0]=C*D,r[1]=C*O,r[2]=C*$,r[3]=C*B,r[4]=C*(g*s+x*M+S*d-(b*s+y*M+A*d)),r[5]=C*(b*o+F*M+T*d-(g*o+z*M+k*d)),r[6]=C*(y*o+z*s+P*d-(x*o+F*s+I*d)),r[7]=C*(A*o+k*s+I*M-(S*o+T*s+P*M)),r[8]=C*(V*h+R*m+E*q-(Z*h+L*m+X*q)),r[9]=C*(Z*a+Y*m+j*q-(V*a+_*m+Q*q)),r[10]=C*(L*a+_*h+N*q-(R*a+Y*h+U*q)),r[11]=C*(X*a+Q*h+U*m-(E*a+j*h+N*m)),r[12]=C*(L*w+X*p+Z*f-(E*p+V*f+R*w)),r[13]=C*(Q*p+V*u+_*w-(Y*w+j*p+Z*u)),r[14]=C*(Y*f+U*p+R*u-(N*p+L*u+_*f)),r[15]=C*(N*w+E*u+j*f-(Q*f+U*w+X*u)),r}const a=u;function s(t,e,r){const o=r??new n(16),c=t[0],u=t[1],a=t[2],s=t[3],i=t[4],f=t[5],h=t[6],M=t[7],l=t[8],w=t[9],m=t[10],d=t[11],v=t[12],p=t[13],q=t[14],b=t[15],g=e[0],x=e[1],y=e[2],A=e[3],S=e[4],z=e[5],F=e[6],T=e[7],k=e[8],I=e[9],P=e[10],V=e[11],Z=e[12],L=e[13],R=e[14],E=e[15];return o[0]=c*g+i*x+l*y+v*A,o[1]=u*g+f*x+w*y+p*A,o[2]=a*g+h*x+m*y+q*A,o[3]=s*g+M*x+d*y+b*A,o[4]=c*S+i*z+l*F+v*T,o[5]=u*S+f*z+w*F+p*T,o[6]=a*S+h*z+m*F+q*T,o[7]=s*S+M*z+d*F+b*T,o[8]=c*k+i*I+l*P+v*V,o[9]=u*k+f*I+w*P+p*V,o[10]=a*k+h*I+m*P+q*V,o[11]=s*k+M*I+d*P+b*V,o[12]=c*Z+i*L+l*R+v*E,o[13]=u*Z+f*L+w*R+p*E,o[14]=a*Z+h*L+m*R+q*E,o[15]=s*Z+M*L+d*R+b*E,o}const i=s,f=t.create(),M=t.create(),l=t.create();function w(t,e,r){const o=r??new n(16);let c=t[0],u=t[1],a=t[2];const s=Math.sqrt(c*c+u*u+a*a);c/=s,u/=s,a/=s;const i=c*c,f=u*u,h=a*a,M=Math.cos(e),l=Math.sin(e),w=1-M;return o[0]=i+(1-i)*M,o[1]=c*u*w+a*l,o[2]=c*a*w-u*l,o[3]=0,o[4]=c*u*w-a*l,o[5]=f+(1-f)*M,o[6]=u*a*w+c*l,o[7]=0,o[8]=c*a*w+u*l,o[9]=u*a*w-c*l,o[10]=h+(1-h)*M,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function m(t,e,r,o){const c=o??new n(16);let u=e[0],a=e[1],s=e[2];const i=Math.sqrt(u*u+a*a+s*s);u/=i,a/=i,s/=i;const f=u*u,h=a*a,M=s*s,l=Math.cos(r),w=Math.sin(r),m=1-l,d=f+(1-f)*l,v=u*a*m+s*w,p=u*s*m-a*w,q=u*a*m-s*w,b=h+(1-h)*l,g=a*s*m+u*w,x=u*s*m+a*w,y=a*s*m-u*w,A=M+(1-M)*l,S=t[0],z=t[1],F=t[2],T=t[3],k=t[4],I=t[5],P=t[6],V=t[7],Z=t[8],L=t[9],R=t[10],E=t[11];return c[0]=d*S+v*k+p*Z,c[1]=d*z+v*I+p*L,c[2]=d*F+v*P+p*R,c[3]=d*T+v*V+p*E,c[4]=q*S+b*k+g*Z,c[5]=q*z+b*I+g*L,c[6]=q*F+b*P+g*R,c[7]=q*T+b*V+g*E,c[8]=x*S+y*k+A*Z,c[9]=x*z+y*I+A*L,c[10]=x*F+y*P+A*R,c[11]=x*T+y*V+A*E,t!==c&&(c[12]=t[12],c[13]=t[13],c[14]=t[14],c[15]=t[15]),c}return{create:function(t,e,r,o,c,u,a,s,i,f,h,M,l,w,m,d){const v=new n(16);return void 0!==t&&(v[0]=t,void 0!==e&&(v[1]=e,void 0!==r&&(v[2]=r,void 0!==o&&(v[3]=o,void 0!==c&&(v[4]=c,void 0!==u&&(v[5]=u,void 0!==a&&(v[6]=a,void 0!==s&&(v[7]=s,void 0!==i&&(v[8]=i,void 0!==f&&(v[9]=f,void 0!==h&&(v[10]=h,void 0!==M&&(v[11]=M,void 0!==l&&(v[12]=l,void 0!==w&&(v[13]=w,void 0!==m&&(v[14]=m,void 0!==d&&(v[15]=d)))))))))))))))),v},set:function(t,e,r,o,c,u,a,s,i,f,h,M,l,w,m,d,v){const p=v??new n(16);return p[0]=t,p[1]=e,p[2]=r,p[3]=o,p[4]=c,p[5]=u,p[6]=a,p[7]=s,p[8]=i,p[9]=f,p[10]=h,p[11]=M,p[12]=l,p[13]=w,p[14]=m,p[15]=d,p},fromMat3:function(t,e){const r=e??new n(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=0,r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=0,r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},fromQuat:function(t,e){const r=e??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,h=o*s,M=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return r[0]=1-l-d,r[1]=M+q,r[2]=w-p,r[3]=0,r[4]=M-q,r[5]=1-h-d,r[6]=m+v,r[7]=0,r[8]=w+p,r[9]=m-v,r[10]=1-h-l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},negate:function(t,e){const r=e??new n(16);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r[11]=-t[11],r[12]=-t[12],r[13]=-t[13],r[14]=-t[14],r[15]=-t[15],r},copy:e,clone:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])o){const n=Math.acos(v),t=Math.sin(n);h=Math.sin((1-r)*n)/t,M=Math.sin(r*n)/t}else h=1-r,M=r;return u[0]=h*a+M*l,u[1]=h*s+M*w,u[2]=h*i+M*m,u[3]=h*f+M*d,u}function i(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}const f=i;function M(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}const l=M;function w(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}const p=v;function q(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}const b=q;function g(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=1),r}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:e,fromValues:r,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,e){const r=e??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>o?(r[0]=n[0]/u,r[1]=n[1]/u,r[2]=n[2]/u):(r[0]=1,r[1]=0,r[2]=0),{angle:c,axis:r}},angle:function(n,t){const e=d(n,t);return Math.acos(2*e*e-1)},multiply:u,mul:a,rotateX:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+i*f,o[1]=a*h+s*f,o[2]=s*h-a*f,o[3]=i*h-u*f,o},rotateY:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h-s*f,o[1]=a*h+i*f,o[2]=s*h+u*f,o[3]=i*h-a*f,o},rotateZ:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+a*f,o[1]=a*h-u*f,o[2]=s*h+i*f,o[3]=i*h-s*f,o},slerp:s,inverse:function(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return r[0]=-o*i,r[1]=-c*i,r[2]=-u*i,r[3]=a*i,r},conjugate:function(t,e){const r=e??new n(4);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r},fromMat:function(t,e){const r=e??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);r[3]=.5*n;const e=.5/n;r[0]=(t[6]-t[9])*e,r[1]=(t[8]-t[2])*e,r[2]=(t[1]-t[4])*e}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const e=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*e+e]-t[4*o+o]+1);r[n]=.5*c;const u=.5/c;r[3]=(t[4*e+o]-t[4*o+e])*u,r[e]=(t[4*e+n]+t[4*n+e])*u,r[o]=(t[4*o+n]+t[4*n+o])*u}return r},fromEuler:function(t,e,r,o,c){const u=c??new n(4),a=.5*t,s=.5*e,i=.5*r,f=Math.sin(a),h=Math.cos(a),M=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"xzy":u[0]=f*l*m-h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m+f*M*w;break;case"yxz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;case"yzx":u[0]=f*l*m+h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m-f*M*w;break;case"zxy":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"zyx":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:i,clone:f,add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},subtract:M,sub:l,mulScalar:w,scale:m,divScalar:function(t,e,r){const o=r??new n(4);return o[0]=t[0]/e,o[1]=t[1]/e,o[2]=t[2]/e,o[3]=t[3]/e,o},dot:d,lerp:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c},length:v,len:p,lengthSq:q,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(e,r,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,e,r,o,c,u){const a=u??new n(4);return s(t,o,c,S),s(e,r,c,z),s(S,z,2*c*(1-c),a),a}}}(n),w.set(n,t)),t}const d=new Map;function v(n){let t=d.get(n);return t||(t=function(n){function t(t,e,r,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==e&&(c[1]=e,void 0!==r&&(c[2]=r,void 0!==o&&(c[3]=o)))),c}function e(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}function r(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c}function c(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}function u(t,e){const r=e??new n(4);return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r[3]=1/t[3],r}function a(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}function s(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}function i(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+c*c)}function f(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return e*e+r*r+o*o+c*c}function h(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function M(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function l(t,e,r){const o=r??new n(4);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o[3]=t[3]*e[3],o}function w(t,e,r){const o=r??new n(4);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o[3]=t[3]/e[3],o}function m(t,e,r){const o=r??new n(4);return h(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},ceil:function(t,e){const r=e??new n(4);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r[3]=Math.ceil(t[3]),r},floor:function(t,e){const r=e??new n(4);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r[3]=Math.floor(t[3]),r},round:function(t,e){const r=e??new n(4);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r[3]=Math.round(t[3]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(4);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c[3]=Math.min(r,Math.max(e,t[3])),c},add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},addScaled:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c[3]=t[3]+e[3]*r,c},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?m(t,e,o):M(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(4))}}}(n),d.set(n,t)),t}function p(n,t,e,r,o,c){return{mat3:i(n),mat4:l(t),quat:m(e),vec2:a(r),vec3:h(o),vec4:v(c)}}const{mat3:q,mat4:b,quat:g,vec2:x,vec3:y,vec4:A}=p(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat3:S,mat4:z,quat:F,vec2:T,vec3:k,vec4:I}=p(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat3:P,mat4:V,quat:Z,vec2:L,vec3:R,vec4:E}=p(t,Array,Array,Array,Array,Array);n.mat3=q,n.mat3d=S,n.mat3n=P,n.mat4=b,n.mat4d=z,n.mat4n=V,n.quat=g,n.quatd=F,n.quatn=Z,n.utils=c,n.vec2=x,n.vec2d=T,n.vec2n=L,n.vec3=y,n.vec3d=k,n.vec3n=R,n.vec4=A,n.vec4d=I,n.vec4n=E})); +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).wgpuMatrix={})}(this,(function(n){"use strict";const t=(e=Array,r=n=>n.fill(0),class extends e{constructor(...n){super(...n),r(this)}});var e,r;let o=1e-6;var c={__proto__:null,get EPSILON(){return o},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,e){const r=t-n;return Math.abs(t-n)1e-5?(r[0]=o/u,r[1]=c/u):(r[0]=0,r[1]=0),r}function l(t,e){const r=e??new n(2);return r[0]=t[0],r[1]=t[1],r}function w(t,e,r){const o=r??new n(2);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o}function m(t,e,r){const o=r??new n(2);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o}function d(t,e,r){const o=r??new n(2);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r){const o=r??new n(2);return o[0]=t,o[1]=e,o},ceil:function(t,e){const r=e??new n(2);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r},floor:function(t,e){const r=e??new n(2);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r},round:function(t,e){const r=e??new n(2);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(2);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c},add:function(t,e,r){const o=r??new n(2);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o},addScaled:function(t,e,r,o){const c=o??new n(2);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=t[0],c=t[1],u=Math.sqrt(e*e+r*r)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(2))}}}(n),u.set(n,t)),t}const s=new Map;function i(n){let t=s.get(n);return t||(t=function(n){function t(t,e,r){const o=new n(3);return void 0!==t&&(o[0]=t,void 0!==e&&(o[1]=e,void 0!==r&&(o[2]=r))),o}function e(t,e,r){const o=r??new n(3);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o}function r(t,e,r,o){const c=o??new n(3);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c}function c(t,e,r){const o=r??new n(3);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o}function u(t,e){const r=e??new n(3);return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r}function a(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function s(n){const t=n[0],e=n[1],r=n[2];return Math.sqrt(t*t+e*e+r*r)}function i(n){const t=n[0],e=n[1],r=n[2];return t*t+e*e+r*r}function f(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(e*e+r*r+o*o)}function h(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2];return e*e+r*r+o*o}function M(t,e){const r=e??new n(3),o=t[0],c=t[1],u=t[2],a=Math.sqrt(o*o+c*c+u*u);return a>1e-5?(r[0]=o/a,r[1]=c/a,r[2]=u/a):(r[0]=0,r[1]=0,r[2]=0),r}function l(t,e){const r=e??new n(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function w(t,e,r){const o=r??new n(3);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o}function m(t,e,r){const o=r??new n(3);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o}function d(t,e,r){const o=r??new n(3);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o){const c=o??new n(3);return c[0]=t,c[1]=e,c[2]=r,c},ceil:function(t,e){const r=e??new n(3);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r},floor:function(t,e){const r=e??new n(3);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r},round:function(t,e){const r=e??new n(3);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(3);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c},add:function(t,e,r){const o=r??new n(3);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o},addScaled:function(t,e,r,o){const c=o??new n(3);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(3))}}}(n),s.set(n,t)),t}const f=new Map;function h(n){let t=f.get(n);return t||(t=function(n){const t=a(n),e=i(n);function r(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[8]=t[8],r[9]=t[9],r[10]=t[10],r}function c(t){const e=t??new n(12);return e[0]=1,e[1]=0,e[2]=0,e[4]=0,e[5]=1,e[6]=0,e[8]=0,e[9]=0,e[10]=1,e}function u(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],h=t[9],M=t[10],l=M*s-i*h,w=-M*a+i*f,m=h*a-s*f,d=1/(o*l+c*w+u*m);return r[0]=l*d,r[1]=(-M*c+u*h)*d,r[2]=(i*c-u*s)*d,r[4]=w*d,r[5]=(M*o-u*f)*d,r[6]=(-i*o+u*a)*d,r[8]=m*d,r[9]=(-h*o+c*f)*d,r[10]=(s*o-c*a)*d,r}function s(t,e,r){const o=r??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],h=t[8],M=t[9],l=t[10],w=e[0],m=e[1],d=e[2],v=e[4],p=e[5],q=e[6],b=e[8],g=e[9],x=e[10];return o[0]=c*w+s*m+h*d,o[1]=u*w+i*m+M*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*p+h*q,o[5]=u*v+i*p+M*q,o[6]=a*v+f*p+l*q,o[8]=c*b+s*g+h*x,o[9]=u*b+i*g+M*x,o[10]=a*b+f*g+l*x,o}return{clone:r,create:function(t,e,r,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==e&&(f[1]=e,void 0!==r&&(f[2]=r,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,e,r,o,c,u,a,s,i,f){const h=f??new n(12);return h[0]=t,h[1]=e,h[2]=r,h[3]=0,h[4]=o,h[5]=c,h[6]=u,h[7]=0,h[8]=a,h[9]=s,h[10]=i,h[11]=0,h},fromMat4:function(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=0,r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=0,r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=0,r},fromQuat:function(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,h=o*s,M=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return r[0]=1-l-d,r[1]=M+q,r[2]=w-p,r[3]=0,r[4]=M-q,r[5]=1-h-d,r[6]=m+v,r[7]=0,r[8]=w+p,r[9]=m-v,r[10]=1-h-l,r[11]=0,r},negate:function(t,e){const r=e??new n(12);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r},copy:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])o){const n=Math.acos(v),t=Math.sin(n);h=Math.sin((1-r)*n)/t,M=Math.sin(r*n)/t}else h=1-r,M=r;return u[0]=h*a+M*l,u[1]=h*s+M*w,u[2]=h*i+M*m,u[3]=h*f+M*d,u}function f(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}const h=f;function M(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}const l=M;function w(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}const p=v;function q(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}const b=q;function g(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=1),r}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:e,fromValues:r,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,e){const r=e??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>o?(r[0]=n[0]/u,r[1]=n[1]/u,r[2]=n[2]/u):(r[0]=1,r[1]=0,r[2]=0),{angle:c,axis:r}},angle:function(n,t){const e=d(n,t);return Math.acos(2*e*e-1)},multiply:u,mul:a,rotateX:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+i*f,o[1]=a*h+s*f,o[2]=s*h-a*f,o[3]=i*h-u*f,o},rotateY:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h-s*f,o[1]=a*h+i*f,o[2]=s*h+u*f,o[3]=i*h-a*f,o},rotateZ:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+a*f,o[1]=a*h-u*f,o[2]=s*h+i*f,o[3]=i*h-s*f,o},slerp:s,inverse:function(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return r[0]=-o*i,r[1]=-c*i,r[2]=-u*i,r[3]=a*i,r},conjugate:function(t,e){const r=e??new n(4);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r},fromMat:function(t,e){const r=e??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);r[3]=.5*n;const e=.5/n;r[0]=(t[6]-t[9])*e,r[1]=(t[8]-t[2])*e,r[2]=(t[1]-t[4])*e}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const e=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*e+e]-t[4*o+o]+1);r[n]=.5*c;const u=.5/c;r[3]=(t[4*e+o]-t[4*o+e])*u,r[e]=(t[4*e+n]+t[4*n+e])*u,r[o]=(t[4*o+n]+t[4*n+o])*u}return r},fromEuler:function(t,e,r,o,c){const u=c??new n(4),a=.5*t,s=.5*e,i=.5*r,f=Math.sin(a),h=Math.cos(a),M=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"xzy":u[0]=f*l*m-h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m+f*M*w;break;case"yxz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;case"yzx":u[0]=f*l*m+h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m-f*M*w;break;case"zxy":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"zyx":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:f,clone:h,add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},subtract:M,sub:l,mulScalar:w,scale:m,divScalar:function(t,e,r){const o=r??new n(4);return o[0]=t[0]/e,o[1]=t[1]/e,o[2]=t[2]/e,o[3]=t[3]/e,o},dot:d,lerp:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c},length:v,len:p,lengthSq:q,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(e,r,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,e,r,o,c,u){const a=u??new n(4);return s(t,o,c,S),s(e,r,c,z),s(S,z,2*c*(1-c),a),a}}}(n),w.set(n,t)),t}const d=new Map;function v(n){let t=d.get(n);return t||(t=function(n){function t(t,e,r,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==e&&(c[1]=e,void 0!==r&&(c[2]=r,void 0!==o&&(c[3]=o)))),c}function e(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}function r(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c}function c(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}function u(t,e){const r=e??new n(4);return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r[3]=1/t[3],r}function a(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}function s(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}function i(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+c*c)}function f(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return e*e+r*r+o*o+c*c}function h(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function M(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function l(t,e,r){const o=r??new n(4);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o[3]=t[3]*e[3],o}function w(t,e,r){const o=r??new n(4);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o[3]=t[3]/e[3],o}function m(t,e,r){const o=r??new n(4);return h(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},ceil:function(t,e){const r=e??new n(4);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r[3]=Math.ceil(t[3]),r},floor:function(t,e){const r=e??new n(4);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r[3]=Math.floor(t[3]),r},round:function(t,e){const r=e??new n(4);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r[3]=Math.round(t[3]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(4);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c[3]=Math.min(r,Math.max(e,t[3])),c},add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},addScaled:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c[3]=t[3]+e[3]*r,c},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?m(t,e,o):M(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(4))}}}(n),d.set(n,t)),t}function p(n,t,e,r,o,c){return{mat3:h(n),mat4:l(t),quat:m(e),vec2:a(r),vec3:i(o),vec4:v(c)}}const{mat3:q,mat4:b,quat:g,vec2:x,vec3:y,vec4:A}=p(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat3:S,mat4:z,quat:F,vec2:T,vec3:k,vec4:I}=p(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat3:P,mat4:V,quat:Z,vec2:L,vec3:R,vec4:E}=p(t,Array,Array,Array,Array,Array);n.mat3=q,n.mat3d=S,n.mat3n=P,n.mat4=b,n.mat4d=z,n.mat4n=V,n.quat=g,n.quatd=F,n.quatn=Z,n.utils=c,n.vec2=x,n.vec2d=T,n.vec2n=L,n.vec3=y,n.vec3d=k,n.vec3n=R,n.vec4=A,n.vec4d=I,n.vec4n=E})); //# sourceMappingURL=wgpu-matrix.min.js.map diff --git a/dist/3.x/wgpu-matrix.min.js.map b/dist/3.x/wgpu-matrix.min.js.map index da7490a..be7da57 100644 --- a/dist/3.x/wgpu-matrix.min.js.map +++ b/dist/3.x/wgpu-matrix.min.js.map @@ -1 +1 @@ -{"version":3,"file":"wgpu-matrix.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","vec2","getVec2API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","transpose","determinant","setTranslation","getTranslation","getAxis","axis","off","setAxis","getScaling","xy","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","dz","az","bz","t1","t2","zScale","transformMat4Upper3x3","transformQuat","qx","qy","qz","w2","uvX","uvY","uvZ","xz","yz","rotateX","p","r","rotateY","rotateZ","vec3","getVec3API","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat3","getMat3API","mat4","getMat4API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat3d","mat4d","quatd","vec2d","vec3d","vec4d","Float64Array","mat3n","mat4n","quatn","vec2n","vec3n","vec4n","Array"],"mappings":"kPAkBO,MAAMA,GAXXC,EAWsC,MAVtCC,EAUsDC,GAAKA,EAAEC,KAAK,GAR3D,cAAcH,EACnB,WAAAI,IAAeC,GACbC,SAASD,GACTJ,EAASM,KACV,IARL,IACEP,EACAC,ECcK,IAAIO,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,uBAxB4BX,EAAWY,EAAWC,GAChD,MAAMC,EAAIF,EAAIZ,EACd,OAAQQ,KAAKO,IAAIH,EAAIZ,GAAKM,EACrBN,GACCa,EAAIb,GAAKc,CACjB,gBAlBqBd,EAAWY,EAAWI,GACzC,OAAOhB,GAAKY,EAAIZ,GAAKgB,CACvB,WAbM,SAAmBC,GACvB,OAAiB,IAAVA,EAAgBT,KAAKC,EAC9B,aAtBM,SAAqBI,GACzB,MAAMK,EAAMZ,EAEZ,OADAA,EAAUO,EACHK,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GvBoB,EAAKhD,EAAG4B,EAChB,EA0DCyE,SAjDF,SAA+CrG,EAAYY,EAAYmB,GAErE,OAAOC,EAAKhC,EAAGY,EAAG,GADFmB,GAAO,IAAIT,EAAK,GAEjC,EAgDD,CA+BUgF,CAAchF,GACpBH,EAAMkC,IAAI/B,EAAMC,IAEXA,CACT,CC3tBA,SAASyU,EAQLC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEF,MAAO,CAELC,KAAMC,EAAiBP,GAEvBQ,KAAMC,EAAiBR,GAEvBS,KAAMC,EAAiBT,GAEvB5P,KAAMC,EAAiB4P,GAEvB7J,KAAMC,EAAiB6J,GAEvBQ,KAAMC,EAAiBR,GAE3B,CAEa,MAAAC,KAKXA,EAAIE,KAKJA,EAAIE,KAKJA,EAAIpQ,KAKJA,EAAIgG,KAKJA,EAAIsK,KAKJA,GACEb,EAEAe,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxER,KAAMS,EAKNP,KAAMQ,EAKNN,KAAMO,EAKN3Q,KAAM4Q,EAKN5K,KAAM6K,EAKNP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxEf,KAAMgB,EAKNd,KAAMe,EAKNb,KAAMc,EAKNlR,KAAMmR,EAKNnL,KAAMoL,EAKNd,KAAMe,GACJ5B,EAEAnW,EAAWgY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file +{"version":3,"file":"wgpu-matrix.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/vec3-impl.ts","../../../src/mat3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n const vec3 = getVec3API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n/**\n * Returns the \"2d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction get3DScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec3.create());\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n get3DScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","v2","dz","az","bz","t1","t2","zScale","w","transformMat4Upper3x3","transformQuat","q","qx","qy","qz","w2","uvX","uvY","uvZ","getTranslation","getAxis","axis","off","getScaling","xx","xy","xz","yx","yy","yz","zx","zy","zz","rotateX","p","r","rotateY","rotateZ","vec2","getVec2API","vec3","getVec3API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","x2","y2","z2","wx","wy","wz","transpose","determinant","setTranslation","setAxis","get3DScaling","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat3","getMat3API","mat4","getMat4API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat3d","mat4d","quatd","vec2d","vec3d","vec4d","Float64Array","mat3n","mat4n","quatn","vec2n","vec3n","vec4n","Array"],"mappings":"kPAkBO,MAAMA,GAXXC,EAWsC,MAVtCC,EAUsDC,GAAKA,EAAEC,KAAK,GAR3D,cAAcH,EACnB,WAAAI,IAAeC,GACbC,SAASD,GACTJ,EAASM,KACV,IARL,IACEP,EACAC,ECcK,IAAIO,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,uBAxB4BX,EAAWY,EAAWC,GAChD,MAAMC,EAAIF,EAAIZ,EACd,OAAQQ,KAAKO,IAAIH,EAAIZ,GAAKM,EACrBN,GACCa,EAAIb,GAAKc,CACjB,gBAlBqBd,EAAWY,EAAWI,GACzC,OAAOhB,GAAKY,EAAIZ,GAAKgB,CACvB,WAbM,SAAmBC,GACvB,OAAiB,IAAVA,EAAgBT,KAAKC,EAC9B,aAtBM,SAAqBI,GACzB,MAAMK,EAAMZ,EAEZ,OADAA,EAAUO,EACHK,CACT,GCgwBA,MAAMC,EAAQ,IAAIC,IAEZ,SAAUC,EAAyCC,GACvD,IAAIC,EAAMJ,EAAMK,IAAIF,GAKpB,OAJKC,IACHA,EAnwBJ,SAA4DD,GAkB5D,SAASG,EAAOC,EAAI,EAAGC,EAAI,GACzB,MAAMC,EAAS,IAAIN,EAAK,GAOxB,YANUO,IAANH,IACFE,EAAO,GAAKF,OACFG,IAANF,IACFC,EAAO,GAAKD,IAGTC,CACR,CAoJD,SAASE,EAAsC9B,EAAYY,EAAYmB,GACrE,MAAMH,EAAUG,GAA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UG,GAAO,IAAIT,EAAK,GAEhC,OAAIe,EAAOrC,GAAKoG,EACPjD,EAAUnD,EAAGoG,EAAQxE,GAGvBoB,EAAKhD,EAAG4B,EAChB,EA0DCyE,SAjDF,SAA+CrG,EAAYY,EAAYmB,GAErE,OAAOC,EAAKhC,EAAGY,EAAG,GADFmB,GAAO,IAAIT,EAAK,GAEjC,EAgDD,CA+BUgF,CAAchF,GACpBH,EAAMkC,IAAI/B,EAAMC,IAEXA,CACT,CC3tBA,SAAS0U,EAQLC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEF,MAAO,CAELC,KAAMC,EAAiBP,GAEvBQ,KAAMC,EAAiBR,GAEvBS,KAAMC,EAAiBT,GAEvBxN,KAAMC,EAAiBwN,GAEvBvN,KAAMC,EAAiBuN,GAEvBQ,KAAMC,EAAiBR,GAE3B,CAEa,MAAAC,KAKXA,EAAIE,KAKJA,EAAIE,KAKJA,EAAIhO,KAKJA,EAAIE,KAKJA,EAAIgO,KAKJA,GACEb,EAEAe,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxER,KAAMS,EAKNP,KAAMQ,EAKNN,KAAMO,EAKNvO,KAAMwO,EAKNtO,KAAMuO,EAKNP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxEf,KAAMgB,EAKNd,KAAMe,EAKNb,KAAMc,EAKN9O,KAAM+O,EAKN7O,KAAM8O,EAKNd,KAAMe,GACJ5B,EAEApW,EAAWiY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file diff --git a/dist/3.x/wgpu-matrix.module.js b/dist/3.x/wgpu-matrix.module.js index a6c0e49..cdecacb 100644 --- a/dist/3.x/wgpu-matrix.module.js +++ b/dist/3.x/wgpu-matrix.module.js @@ -1,4 +1,4 @@ -/* wgpu-matrix@3.0.3, license MIT */ +/* wgpu-matrix@3.1.0, license MIT */ function wrapConstructor(OriginalConstructor, modifier) { return class extends OriginalConstructor { constructor(...args) { @@ -824,1405 +824,1378 @@ function getAPI$5(Ctor) { * DEALINGS IN THE SOFTWARE. */ /** - * Generates a typed API for Mat3 + * Generates am typed API for Vec3 * */ function getAPIImpl$4(Ctor) { - const vec2 = getAPI$5(Ctor); /** - * Create a Mat3 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat3's specified type - * it would be faster to use - * - * ``` - * const m = mat3.clone(someJSArray); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @returns matrix created from values. + * Creates a vec3; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector */ - function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { - const newDst = new Ctor(12); - // to make the array homogenous - newDst[3] = 0; - newDst[7] = 0; - newDst[11] = 0; - if (v0 !== undefined) { - newDst[0] = v0; - if (v1 !== undefined) { - newDst[1] = v1; - if (v2 !== undefined) { - newDst[2] = v2; - if (v3 !== undefined) { - newDst[4] = v3; - if (v4 !== undefined) { - newDst[5] = v4; - if (v5 !== undefined) { - newDst[6] = v5; - if (v6 !== undefined) { - newDst[8] = v6; - if (v7 !== undefined) { - newDst[9] = v7; - if (v8 !== undefined) { - newDst[10] = v8; - } - } - } - } - } - } + function create(x, y, z) { + const newDst = new Ctor(3); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; } } } return newDst; } /** - * Sets the values of a Mat3 - * Also see {@link mat3.create} and {@link mat3.copy} + * Creates a vec3; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Vec3 + * Also see {@link vec3.create} and {@link vec3.copy} * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 set from values. + * @param x first value + * @param y second value + * @param z third value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. */ - function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = v0; - newDst[1] = v1; - newDst[2] = v2; - newDst[3] = 0; - newDst[4] = v3; - newDst[5] = v4; - newDst[6] = v5; - newDst[7] = 0; - newDst[8] = v6; - newDst[9] = v7; - newDst[10] = v8; - newDst[11] = 0; + function set(x, y, z, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; return newDst; } /** - * Creates a Mat3 from the upper left 3x3 part of a Mat4 - * @param m4 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from m4 + * Applies Math.ceil to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the ceil of each element of v. */ - function fromMat4(m4, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = m4[0]; - newDst[1] = m4[1]; - newDst[2] = m4[2]; - newDst[3] = 0; - newDst[4] = m4[4]; - newDst[5] = m4[5]; - newDst[6] = m4[6]; - newDst[7] = 0; - newDst[8] = m4[8]; - newDst[9] = m4[9]; - newDst[10] = m4[10]; - newDst[11] = 0; + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); return newDst; } /** - * Creates a Mat3 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from q + * Applies Math.floor to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the floor of each element of v. */ - function fromQuat(q, dst) { - const newDst = (dst ?? new Ctor(12)); - const x = q[0]; - const y = q[1]; - const z = q[2]; - const w = q[3]; - const x2 = x + x; - const y2 = y + y; - const z2 = z + z; - const xx = x * x2; - const yx = y * x2; - const yy = y * y2; - const zx = z * x2; - const zy = z * y2; - const zz = z * z2; - const wx = w * x2; - const wy = w * y2; - const wz = w * z2; - newDst[0] = 1 - yy - zz; - newDst[1] = yx + wz; - newDst[2] = zx - wy; - newDst[3] = 0; - newDst[4] = yx - wz; - newDst[5] = 1 - xx - zz; - newDst[6] = zy + wx; - newDst[7] = 0; - newDst[8] = zx + wy; - newDst[9] = zy - wx; - newDst[10] = 1 - xx - yy; - newDst[11] = 0; + function floor(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); return newDst; } /** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. + * Applies Math.round to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the round of each element of v. */ - function negate(m, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = -m[0]; - newDst[1] = -m[1]; - newDst[2] = -m[2]; - newDst[4] = -m[4]; - newDst[5] = -m[5]; - newDst[6] = -m[6]; - newDst[8] = -m[8]; - newDst[9] = -m[9]; - newDst[10] = -m[10]; + function round(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); return newDst; } /** - * Copies a matrix. (same as {@link mat3.clone}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. + * Clamp each element of vector between min and max + * @param v - Operand vector. + * @param max - Min value, default 0 + * @param min - Max value, default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that the clamped value of each element of v. */ - function copy(m, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = m[0]; - newDst[1] = m[1]; - newDst[2] = m[2]; - newDst[4] = m[4]; - newDst[5] = m[5]; - newDst[6] = m[6]; - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); return newDst; } /** - * Copies a matrix (same as {@link mat3.copy}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. + * Adds two vectors; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a and b. */ - const clone = copy; + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + return newDst; + } /** - * Check if 2 matrices are approximately equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are approximately equal + * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param scale - Amount to scale b + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a + b * scale. + */ + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + return newDst; + } + /** + * Returns the angle in radians between two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns The angle in radians between the 2 vectors. + */ + function angle(a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); + const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); + const mag = mag1 * mag2; + const cosine = mag && dot(a, b) / mag; + return Math.acos(cosine); + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + const sub = subtract; + /** + * Check if 2 vectors are approximately equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are approximately equal */ function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[4] - b[4]) < EPSILON && - Math.abs(a[5] - b[5]) < EPSILON && - Math.abs(a[6] - b[6]) < EPSILON && - Math.abs(a[8] - b[8]) < EPSILON && - Math.abs(a[9] - b[9]) < EPSILON && - Math.abs(a[10] - b[10]) < EPSILON; + Math.abs(a[2] - b[2]) < EPSILON; } /** - * Check if 2 matrices are exactly equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are exactly equal + * Check if 2 vectors are exactly equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are exactly equal */ function equals(a, b) { - return a[0] === b[0] && - a[1] === b[1] && - a[2] === b[2] && - a[4] === b[4] && - a[5] === b[5] && - a[6] === b[6] && - a[8] === b[8] && - a[9] === b[9] && - a[10] === b[10]; + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } /** - * Creates a 3-by-3 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 3-by-3 identity matrix. + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficient. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. */ - function identity(dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = 1; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = 1; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); return newDst; } /** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient vector t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficients vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns the linear interpolated result. */ - function transpose(m, dst) { - const newDst = (dst ?? new Ctor(12)); - if (newDst === m) { - let t; - // 0 1 2 - // 4 5 6 - // 8 9 10 - t = m[1]; - m[1] = m[4]; - m[4] = t; - t = m[2]; - m[2] = m[8]; - m[8] = t; - t = m[6]; - m[6] = m[9]; - m[9] = t; - return newDst; - } - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - newDst[0] = m00; - newDst[1] = m10; - newDst[2] = m20; - newDst[4] = m01; - newDst[5] = m11; - newDst[6] = m21; - newDst[8] = m02; - newDst[9] = m12; - newDst[10] = m22; + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); return newDst; } /** - * Computes the inverse of a 3-by-3 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. + * Return max values of two vectors. + * Given vectors a and b returns + * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The max components vector. */ - function inverse(m, dst) { - const newDst = (dst ?? new Ctor(12)); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const b01 = m22 * m11 - m12 * m21; - const b11 = -m22 * m10 + m12 * m20; - const b21 = m21 * m10 - m11 * m20; - const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); - newDst[0] = b01 * invDet; - newDst[1] = (-m22 * m01 + m02 * m21) * invDet; - newDst[2] = (m12 * m01 - m02 * m11) * invDet; - newDst[4] = b11 * invDet; - newDst[5] = (m22 * m00 - m02 * m20) * invDet; - newDst[6] = (-m12 * m00 + m02 * m10) * invDet; - newDst[8] = b21 * invDet; - newDst[9] = (-m21 * m00 + m01 * m20) * invDet; - newDst[10] = (m11 * m00 - m01 * m10) * invDet; + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); return newDst; } /** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant + * Return min values of two vectors. + * Given vectors a and b returns + * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The min components vector. */ - function determinant(m) { - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - return m00 * (m11 * m22 - m21 * m12) - - m10 * (m01 * m22 - m21 * m02) + - m20 * (m01 * m12 - m11 * m02); + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + return newDst; } /** - * Computes the inverse of a 3-by-3 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. + * Multiplies a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - const invert = inverse; + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + return newDst; + } /** - * Multiplies two 3-by-3 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ - function multiply(a, b, dst) { - const newDst = (dst ?? new Ctor(12)); - const a00 = a[0]; - const a01 = a[1]; - const a02 = a[2]; - const a10 = a[4 + 0]; - const a11 = a[4 + 1]; - const a12 = a[4 + 2]; - const a20 = a[8 + 0]; - const a21 = a[8 + 1]; - const a22 = a[8 + 2]; - const b00 = b[0]; - const b01 = b[1]; - const b02 = b[2]; - const b10 = b[4 + 0]; - const b11 = b[4 + 1]; - const b12 = b[4 + 2]; - const b20 = b[8 + 0]; - const b21 = b[8 + 1]; - const b22 = b[8 + 2]; - newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; - newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; - newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; - newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; - newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; - newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; - newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; - newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; - newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; - return newDst; - } - /** - * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. + * Multiplies a vector by a scalar. (same as mulScalar) + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - const mul = multiply; + const scale = mulScalar; /** - * Sets the translation component of a 3-by-3 matrix to the given - * vector. - * @param a - The matrix. + * Divides a vector by a scalar. * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. */ - function setTranslation(a, v, dst) { - const newDst = (dst ?? identity()); - if (a !== newDst) { - newDst[0] = a[0]; - newDst[1] = a[1]; - newDst[2] = a[2]; - newDst[4] = a[4]; - newDst[5] = a[5]; - newDst[6] = a[6]; - } - newDst[8] = v[0]; - newDst[9] = v[1]; - newDst[10] = 1; + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; return newDst; } /** - * Returns the translation component of a 3-by-3 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. + * Inverse a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. */ - function getTranslation(m, dst) { - const newDst = (dst ?? vec2.create()); - newDst[0] = m[8]; - newDst[1] = m[9]; + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; return newDst; } /** - * Returns an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, - * @returns The axis component of m. + * Invert a vector. (same as inverse) + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. */ - function getAxis(m, axis, dst) { - const newDst = (dst ?? vec2.create()); - const off = axis * 4; - newDst[0] = m[off + 0]; - newDst[1] = m[off + 1]; - return newDst; - } + const invert = inverse; /** - * Sets an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. + * Computes the cross product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of a cross b. */ - function setAxis(m, v, axis, dst) { - const newDst = (dst === m ? m : copy(m, dst)); - const off = axis * 4; - newDst[off + 0] = v[0]; - newDst[off + 1] = v[1]; - return newDst; - } - ///** - // * Returns the scaling component of the matrix - // * @param m - The Matrix - // * @param dst - The vector to set. If not passed a new one is created. - // */ - function getScaling(m, dst) { - const newDst = (dst ?? vec2.create()); - const xx = m[0]; - const xy = m[1]; - const yx = m[4]; - const yy = m[5]; - newDst[0] = Math.sqrt(xx * xx + xy * xy); - newDst[1] = Math.sqrt(yx * yx + yy * yy); + function cross(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + const t1 = a[2] * b[0] - a[0] * b[2]; + const t2 = a[0] * b[1] - a[1] * b[0]; + newDst[0] = a[1] * b[2] - a[2] * b[1]; + newDst[1] = t1; + newDst[2] = t2; return newDst; } /** - * Creates a 3-by-3 matrix which translates by the given vector v. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. + * Computes the dot product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns dot product */ - function translation(v, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = 1; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = 1; - newDst[6] = 0; - newDst[8] = v[0]; - newDst[9] = v[1]; - newDst[10] = 1; - return newDst; + function dot(a, b) { + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); } /** - * Translates the given 3-by-3 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. + * Computes the length of vector + * @param v - vector. + * @returns length of vector. */ - function translate(m, v, dst) { - const newDst = (dst ?? new Ctor(12)); + function length(v) { const v0 = v[0]; const v1 = v[1]; - const m00 = m[0]; - const m01 = m[1]; - const m02 = m[2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - if (m !== newDst) { - newDst[0] = m00; - newDst[1] = m01; - newDst[2] = m02; - newDst[4] = m10; - newDst[5] = m11; - newDst[6] = m12; - } - newDst[8] = m00 * v0 + m10 * v1 + m20; - newDst[9] = m01 * v0 + m11 * v1 + m21; - newDst[10] = m02 * v0 + m12 * v1 + m22; - return newDst; + const v2 = v[2]; + return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); } /** - * Creates a 3-by-3 matrix which rotates by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. + * Computes the length of vector (same as length) + * @param v - vector. + * @returns length of vector. */ - function rotation(angleInRadians, dst) { - const newDst = (dst ?? new Ctor(12)); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - newDst[0] = c; - newDst[1] = s; - newDst[2] = 0; - newDst[4] = -s; - newDst[5] = c; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + const len = length; + /** + * Computes the square of the length of vector + * @param v - vector. + * @returns square of the length of vector. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + return v0 * v0 + v1 * v1 + v2 * v2; } /** - * Rotates the given 3-by-3 matrix by the given angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. + * Computes the square of the length of vector (same as lengthSq) + * @param v - vector. + * @returns square of the length of vector. */ - function rotate(m, angleInRadians, dst) { - const newDst = (dst ?? new Ctor(12)); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - newDst[0] = c * m00 + s * m10; - newDst[1] = c * m01 + s * m11; - newDst[2] = c * m02 + s * m12; - newDst[4] = c * m10 - s * m00; - newDst[5] = c * m11 - s * m01; - newDst[6] = c * m12 - s * m02; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } + const lenSq = lengthSq; /** - * Creates a 3-by-3 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * 2 entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. + * Computes the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns distance between a and b */ - function scaling(v, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = v[0]; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = v[1]; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + function distance(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return Math.sqrt(dx * dx + dy * dy + dz * dz); } /** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of 2 entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. + * Computes the distance between 2 points (same as distance) + * @param a - vector. + * @param b - vector. + * @returns distance between a and b */ - function scale(m, v, dst) { - const newDst = (dst ?? new Ctor(12)); - const v0 = v[0]; - const v1 = v[1]; - newDst[0] = v0 * m[0 * 4 + 0]; - newDst[1] = v0 * m[0 * 4 + 1]; - newDst[2] = v0 * m[0 * 4 + 2]; - newDst[4] = v1 * m[1 * 4 + 0]; - newDst[5] = v1 * m[1 * 4 + 1]; - newDst[6] = v1 * m[1 * 4 + 2]; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } + const dist = distance; /** - * Creates a 3-by-3 matrix which scales uniformly in each dimension - * @param s - Amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. + * Computes the square of the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b */ - function uniformScaling(s, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = s; - newDst[1] = 0; - newDst[2] = 0; - newDst[4] = 0; - newDst[5] = s; - newDst[6] = 0; - newDst[8] = 0; - newDst[9] = 0; - newDst[10] = 1; - return newDst; + function distanceSq(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return dx * dx + dy * dy + dz * dz; } /** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given. - * @param m - The matrix to be modified. - * @param s - Amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. + * Computes the square of the distance between 2 points (same as distanceSq) + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b */ - function uniformScale(m, s, dst) { - const newDst = (dst ?? new Ctor(12)); - newDst[0] = s * m[0 * 4 + 0]; - newDst[1] = s * m[0 * 4 + 1]; - newDst[2] = s * m[0 * 4 + 2]; - newDst[4] = s * m[1 * 4 + 0]; - newDst[5] = s * m[1 * 4 + 1]; - newDst[6] = s * m[1 * 4 + 2]; - if (m !== newDst) { - newDst[8] = m[8]; - newDst[9] = m[9]; - newDst[10] = m[10]; - } - return newDst; - } - return { - clone, - create, - set, - fromMat4, - fromQuat, - negate, - copy, - equalsApproximately, - equals, - identity, - transpose, - inverse, - invert, - determinant, - mul, - multiply, - setTranslation, - getTranslation, - getAxis, - setAxis, - getScaling, - translation, - translate, - rotation, - rotate, - scaling, - scale, - uniformScaling, - uniformScale, - }; -} -const cache$4 = new Map(); -function getAPI$4(Ctor) { - let api = cache$4.get(Ctor); - if (!api) { - api = getAPIImpl$4(Ctor); - cache$4.set(Ctor, api); - } - return api; -} - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * Generates am typed API for Vec3 - * */ -function getAPIImpl$3(Ctor) { + const distSq = distanceSq; /** - * Creates a vec3; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector + * Divides a vector by its Euclidean length and returns the quotient. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The normalized vector. */ - function create(x, y, z) { - const newDst = new Ctor(3); - if (x !== undefined) { - newDst[0] = x; - if (y !== undefined) { - newDst[1] = y; - if (z !== undefined) { - newDst[2] = z; - } - } + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(3)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; } return newDst; } /** - * Creates a vec3; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ - const fromValues = create; - /** - * Sets the values of a Vec3 - * Also see {@link vec3.create} and {@link vec3.copy} - * - * @param x first value - * @param y second value - * @param z third value + * Negates a vector. + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. + * @returns -v. */ - function set(x, y, z, dst) { + function negate(v, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = x; - newDst[1] = y; - newDst[2] = z; + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; return newDst; } /** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. + * Copies a vector. (same as {@link vec3.clone}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. + * @returns A copy of v. */ - function ceil(v, dst) { + function copy(v, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.ceil(v[0]); - newDst[1] = Math.ceil(v[1]); - newDst[2] = Math.ceil(v[2]); - return newDst; - } - /** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ - function floor(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.floor(v[0]); - newDst[1] = Math.floor(v[1]); - newDst[2] = Math.floor(v[2]); - return newDst; - } - /** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ - function round(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.round(v[0]); - newDst[1] = Math.round(v[1]); - newDst[2] = Math.round(v[2]); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; return newDst; } /** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 + * Clones a vector. (same as {@link vec3.copy}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. + * @returns A copy of v. */ - function clamp(v, min = 0, max = 1, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.min(max, Math.max(min, v[0])); - newDst[1] = Math.min(max, Math.max(min, v[1])); - newDst[2] = Math.min(max, Math.max(min, v[2])); - return newDst; - } + const clone = copy; /** - * Adds two vectors; assumes a and b have the same dimension. + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. + * @returns The vector of products of entries of a and b. */ - function add(a, b, dst) { + function multiply(a, b, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + b[0]; - newDst[1] = a[1] + b[1]; - newDst[2] = a[2] + b[2]; + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; return newDst; } /** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. (same as mul) * @param a - Operand vector. * @param b - Operand vector. - * @param scale - Amount to scale b * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ - function addScaled(a, b, scale, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + b[0] * scale; - newDst[1] = a[1] + b[1] * scale; - newDst[2] = a[2] + b[2] * scale; - return newDst; - } - /** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. + * @returns The vector of products of entries of a and b. */ - function angle(a, b) { - const ax = a[0]; - const ay = a[1]; - const az = a[2]; - const bx = b[0]; - const by = b[1]; - const bz = b[2]; - const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); - const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); - const mag = mag1 * mag2; - const cosine = mag && dot(a, b) / mag; - return Math.acos(cosine); - } + const mul = multiply; /** - * Subtracts two vectors. + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. + * @returns The vector of quotients of entries of a and b. */ - function subtract(a, b, dst) { + function divide(a, b, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] - b[0]; - newDst[1] = a[1] - b[1]; - newDst[2] = a[2] - b[2]; + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; return newDst; } /** - * Subtracts two vectors. + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. (same as divide) * @param a - Operand vector. * @param b - Operand vector. * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ - const sub = subtract; - /** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ - function equalsApproximately(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON; - } - /** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal + * @returns The vector of quotients of entries of a and b. */ - function equals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; - } + const div = divide; /** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. + * Creates a random vector + * @param scale - Default 1 * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. + * @returns The random vector. */ - function lerp(a, b, t, dst) { + function random(scale = 1, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + t * (b[0] - a[0]); - newDst[1] = a[1] + t * (b[1] - a[1]); - newDst[2] = a[2] + t * (b[2] - a[2]); + const angle = Math.random() * 2 * Math.PI; + const z = Math.random() * 2 - 1; + const zScale = Math.sqrt(1 - z * z) * scale; + newDst[0] = Math.cos(angle) * zScale; + newDst[1] = Math.sin(angle) * zScale; + newDst[2] = z * scale; return newDst; } /** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. + * Zero's a vector * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. + * @returns The zeroed vector. */ - function lerpV(a, b, t, dst) { + function zero(dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] + t[0] * (b[0] - a[0]); - newDst[1] = a[1] + t[1] * (b[1] - a[1]); - newDst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; return newDst; } /** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. + * transform vec3 by 4x4 matrix + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector */ - function max(a, b, dst) { + function transformMat4(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.max(a[0], b[0]); - newDst[1] = Math.max(a[1], b[1]); - newDst[2] = Math.max(a[2], b[2]); + const x = v[0]; + const y = v[1]; + const z = v[2]; + const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; + newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return newDst; } /** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. + * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. + * @param v - The direction. + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns The transformed vector. */ - function min(a, b, dst) { + function transformMat4Upper3x3(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = Math.min(a[0], b[0]); - newDst[1] = Math.min(a[1], b[1]); - newDst[2] = Math.min(a[2], b[2]); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; return newDst; } /** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. + * Transforms vec3 by 3x3 matrix + * + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector */ - function mulScalar(v, k, dst) { + function transformMat3(v, m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0] * k; - newDst[1] = v[1] * k; - newDst[2] = v[2] * k; + const x = v[0]; + const y = v[1]; + const z = v[2]; + newDst[0] = x * m[0] + y * m[4] + z * m[8]; + newDst[1] = x * m[1] + y * m[5] + z * m[9]; + newDst[2] = x * m[2] + y * m[6] + z * m[10]; return newDst; } /** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. + * Transforms vec3 by Quaternion + * @param v - the vector to transform + * @param q - the quaternion to transform by + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed */ - const scale = mulScalar; - /** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ - function divScalar(v, k, dst) { + function transformQuat(v, q, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0] / k; - newDst[1] = v[1] / k; - newDst[2] = v[2] / k; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = v[0]; + const y = v[1]; + const z = v[2]; + const uvX = qy * z - qz * y; + const uvY = qz * x - qx * z; + const uvZ = qx * y - qy * x; + newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; + newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; + newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; return newDst; } /** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. + * Returns the translation component of a 4-by-4 matrix as a vector with 3 + * entries. + * @param m - The matrix. + * @param dst - vector to hold result. If not passed a new one is created. + * @returns The translation component of m. */ - function inverse(v, dst) { + function getTranslation(m, dst) { const newDst = (dst ?? new Ctor(3)); - newDst[0] = 1 / v[0]; - newDst[1] = 1 / v[1]; - newDst[2] = 1 / v[2]; + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; return newDst; } /** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. + * Returns an axis of a 4x4 matrix as a vector with 3 entries + * @param m - The matrix. + * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @returns The axis component of m. */ - const invert = inverse; + function getAxis(m, axis, dst) { + const newDst = (dst ?? new Ctor(3)); + const off = axis * 4; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; + } /** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. + * Returns the scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. */ - function cross(a, b, dst) { + function getScaling(m, dst) { const newDst = (dst ?? new Ctor(3)); - const t1 = a[2] * b[0] - a[0] * b[2]; - const t2 = a[0] * b[1] - a[1] * b[0]; - newDst[0] = a[1] * b[2] - a[2] * b[1]; - newDst[1] = t1; - newDst[2] = t2; + const xx = m[0]; + const xy = m[1]; + const xz = m[2]; + const yx = m[4]; + const yy = m[5]; + const yz = m[6]; + const zx = m[8]; + const zy = m[9]; + const zz = m[10]; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); return newDst; } /** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product + * Rotate a 3D vector around the x-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector */ - function dot(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); + function rotateX(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + //Translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + //perform rotation + r[0] = p[0]; + r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); + r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); + //translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. + * Rotate a 3D vector around the y-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector */ - function length(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + function rotateY(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); + r[1] = p[1]; + r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. + * Rotate a 3D vector around the z-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns {vec3} out */ - const len = length; + function rotateZ(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); + r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); + r[2] = p[2]; + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; + } /** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. + * Treat a 3D vector as a direction and set it's length + * + * @param a The vec3 to lengthen + * @param len The length of the resulting vector + * @returns The lengthened vector */ - function lengthSq(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return v0 * v0 + v1 * v1 + v2 * v2; + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(3)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. + * Ensure a vector is not longer than a max length + * + * @param a The vec3 to limit + * @param maxLen The longest length of the resulting vector + * @returns The vector, shortened to maxLen if it's too long */ - const lenSq = lengthSq; + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(3)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); + } + return copy(a, newDst); + } /** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b + * Return the vector exactly between 2 endpoint vectors + * + * @param a Endpoint 1 + * @param b Endpoint 2 + * @returns The vector exactly residing between endpoints 1 and 2 */ - function distance(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return Math.sqrt(dx * dx + dy * dy + dz * dz); + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + return lerp(a, b, 0.5, newDst); } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat4Upper3x3, + transformMat3, + transformQuat, + getTranslation, + getAxis, + getScaling, + rotateX, + rotateY, + rotateZ, + setLength, + truncate, + midpoint, + }; +} +const cache$4 = new Map(); +function getAPI$4(Ctor) { + let api = cache$4.get(Ctor); + if (!api) { + api = getAPIImpl$4(Ctor); + cache$4.set(Ctor, api); + } + return api; +} + +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates a typed API for Mat3 + * */ +function getAPIImpl$3(Ctor) { + const vec2 = getAPI$5(Ctor); + const vec3 = getAPI$4(Ctor); /** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b + * Create a Mat3 from values + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Mat3's specified type + * it would be faster to use + * + * ``` + * const m = mat3.clone(someJSArray); + * ``` + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @returns matrix created from values. */ - const dist = distance; + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { + const newDst = new Ctor(12); + // to make the array homogenous + newDst[3] = 0; + newDst[7] = 0; + newDst[11] = 0; + if (v0 !== undefined) { + newDst[0] = v0; + if (v1 !== undefined) { + newDst[1] = v1; + if (v2 !== undefined) { + newDst[2] = v2; + if (v3 !== undefined) { + newDst[4] = v3; + if (v4 !== undefined) { + newDst[5] = v4; + if (v5 !== undefined) { + newDst[6] = v5; + if (v6 !== undefined) { + newDst[8] = v6; + if (v7 !== undefined) { + newDst[9] = v7; + if (v8 !== undefined) { + newDst[10] = v8; + } + } + } + } + } + } + } + } + } + return newDst; + } /** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b + * Sets the values of a Mat3 + * Also see {@link mat3.create} and {@link mat3.copy} + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 set from values. */ - function distanceSq(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return dx * dx + dy * dy + dz * dz; + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = 0; + newDst[4] = v3; + newDst[5] = v4; + newDst[6] = v5; + newDst[7] = 0; + newDst[8] = v6; + newDst[9] = v7; + newDst[10] = v8; + newDst[11] = 0; + return newDst; } /** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b + * Creates a Mat3 from the upper left 3x3 part of a Mat4 + * @param m4 - source matrix + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from m4 */ - const distSq = distanceSq; + function fromMat4(m4, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m4[0]; + newDst[1] = m4[1]; + newDst[2] = m4[2]; + newDst[3] = 0; + newDst[4] = m4[4]; + newDst[5] = m4[5]; + newDst[6] = m4[6]; + newDst[7] = 0; + newDst[8] = m4[8]; + newDst[9] = m4[9]; + newDst[10] = m4[10]; + newDst[11] = 0; + return newDst; + } /** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. + * Creates a Mat3 rotation matrix from a quaternion + * @param q - quaternion to create matrix from + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from q */ - function normalize(v, dst) { - const newDst = (dst ?? new Ctor(3)); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); - if (len > 0.00001) { - newDst[0] = v0 / len; - newDst[1] = v1 / len; - newDst[2] = v2 / len; - } - else { - newDst[0] = 0; - newDst[1] = 0; - newDst[2] = 0; - } + function fromQuat(q, dst) { + const newDst = (dst ?? new Ctor(12)); + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const yx = y * x2; + const yy = y * y2; + const zx = z * x2; + const zy = z * y2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; return newDst; } /** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. + * Negates a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns -m. */ - function negate(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = -v[0]; - newDst[1] = -v[1]; - newDst[2] = -v[2]; + function negate(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; return newDst; } /** - * Copies a vector. (same as {@link vec3.clone}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. + * Copies a matrix. (same as {@link mat3.clone}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. */ - function copy(v, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = v[0]; - newDst[1] = v[1]; - newDst[2] = v[2]; + function copy(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; return newDst; } /** - * Clones a vector. (same as {@link vec3.copy}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. + * Copies a matrix (same as {@link mat3.copy}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. */ const clone = copy; /** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. + * Check if 2 matrices are approximately equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are approximately equal */ - function multiply(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] * b[0]; - newDst[1] = a[1] * b[1]; - newDst[2] = a[2] * b[2]; - return newDst; + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[4] - b[4]) < EPSILON && + Math.abs(a[5] - b[5]) < EPSILON && + Math.abs(a[6] - b[6]) < EPSILON && + Math.abs(a[8] - b[8]) < EPSILON && + Math.abs(a[9] - b[9]) < EPSILON && + Math.abs(a[10] - b[10]) < EPSILON; } /** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. + * Check if 2 matrices are exactly equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are exactly equal */ - const mul = multiply; + function equals(a, b) { + return a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[8] === b[8] && + a[9] === b[9] && + a[10] === b[10]; + } /** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. + * Creates a 3-by-3 identity matrix. + * + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A 3-by-3 identity matrix. */ - function divide(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = a[0] / b[0]; - newDst[1] = a[1] / b[1]; - newDst[2] = a[2] / b[2]; + function identity(dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ - const div = divide; - /** - * Creates a random vector - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. + * Takes the transpose of a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The transpose of m. */ - function random(scale = 1, dst) { - const newDst = (dst ?? new Ctor(3)); - const angle = Math.random() * 2 * Math.PI; - const z = Math.random() * 2 - 1; - const zScale = Math.sqrt(1 - z * z) * scale; - newDst[0] = Math.cos(angle) * zScale; - newDst[1] = Math.sin(angle) * zScale; - newDst[2] = z * scale; + function transpose(m, dst) { + const newDst = (dst ?? new Ctor(12)); + if (newDst === m) { + let t; + // 0 1 2 + // 4 5 6 + // 8 9 10 + t = m[1]; + m[1] = m[4]; + m[4] = t; + t = m[2]; + m[2] = m[8]; + m[8] = t; + t = m[6]; + m[6] = m[9]; + m[9] = t; + return newDst; + } + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; return newDst; } /** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. + * Computes the inverse of a 3-by-3 matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. */ - function zero(dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = 0; - newDst[1] = 0; - newDst[2] = 0; + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const b01 = m22 * m11 - m12 * m21; + const b11 = -m22 * m10 + m12 * m20; + const b21 = m21 * m10 - m11 * m20; + const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); + newDst[0] = b01 * invDet; + newDst[1] = (-m22 * m01 + m02 * m21) * invDet; + newDst[2] = (m12 * m01 - m02 * m11) * invDet; + newDst[4] = b11 * invDet; + newDst[5] = (m22 * m00 - m02 * m20) * invDet; + newDst[6] = (-m12 * m00 + m02 * m10) * invDet; + newDst[8] = b21 * invDet; + newDst[9] = (-m21 * m00 + m01 * m20) * invDet; + newDst[10] = (m11 * m00 - m01 * m10) * invDet; return newDst; } /** - * transform vec3 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector + * Compute the determinant of a matrix + * @param m - the matrix + * @returns the determinant */ - function transformMat4(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const x = v[0]; - const y = v[1]; - const z = v[2]; - const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; - newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return newDst; + function determinant(m) { + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + return m00 * (m11 * m22 - m21 * m12) - + m10 * (m01 * m22 - m21 * m02) + + m20 * (m01 * m12 - m11 * m02); } /** - * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. - * @param v - The direction. + * Computes the inverse of a 3-by-3 matrix. (same as inverse) * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns The transformed vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. */ - function transformMat4Upper3x3(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; - newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; - newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; - return newDst; - } + const invert = inverse; /** - * Transforms vec3 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector + * Multiplies two 3-by-3 matrices with a on the left and b on the right + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. */ - function transformMat3(v, m, dst) { - const newDst = (dst ?? new Ctor(3)); - const x = v[0]; - const y = v[1]; - const z = v[2]; - newDst[0] = x * m[0] + y * m[4] + z * m[8]; - newDst[1] = x * m[1] + y * m[5] + z * m[9]; - newDst[2] = x * m[2] + y * m[6] + z * m[10]; + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(12)); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[4 + 0]; + const a11 = a[4 + 1]; + const a12 = a[4 + 2]; + const a20 = a[8 + 0]; + const a21 = a[8 + 1]; + const a22 = a[8 + 2]; + const b00 = b[0]; + const b01 = b[1]; + const b02 = b[2]; + const b10 = b[4 + 0]; + const b11 = b[4 + 1]; + const b12 = b[4 + 2]; + const b20 = b[8 + 0]; + const b21 = b[8 + 1]; + const b22 = b[8 + 2]; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; return newDst; } /** - * Transforms vec3 by Quaternion - * @param v - the vector to transform - * @param q - the quaternion to transform by - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed + * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. */ - function transformQuat(v, q, dst) { - const newDst = (dst ?? new Ctor(3)); - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const w2 = q[3] * 2; - const x = v[0]; - const y = v[1]; - const z = v[2]; - const uvX = qy * z - qz * y; - const uvY = qz * x - qx * z; - const uvZ = qx * y - qy * x; - newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; - newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; - newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; + const mul = multiply; + /** + * Sets the translation component of a 3-by-3 matrix to the given + * vector. + * @param a - The matrix. + * @param v - The vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix with translation set. + */ + function setTranslation(a, v, dst) { + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; + } + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; return newDst; } /** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 + * Returns the translation component of a 3-by-3 matrix as a vector with 3 * entries. * @param m - The matrix. * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ function getTranslation(m, dst) { - const newDst = (dst ?? new Ctor(3)); - newDst[0] = m[12]; - newDst[1] = m[13]; - newDst[2] = m[14]; + const newDst = (dst ?? vec2.create()); + newDst[0] = m[8]; + newDst[1] = m[9]; return newDst; } /** - * Returns an axis of a 4x4 matrix as a vector with 3 entries + * Returns an axis of a 3x3 matrix as a vector with 2 entries * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @param axis - The axis 0 = x, 1 = y, * @returns The axis component of m. */ function getAxis(m, axis, dst) { - const newDst = (dst ?? new Ctor(3)); + const newDst = (dst ?? vec2.create()); const off = axis * 4; newDst[0] = m[off + 0]; newDst[1] = m[off + 1]; - newDst[2] = m[off + 2]; return newDst; } /** - * Returns the scaling component of the matrix + * Sets an axis of a 3x3 matrix as a vector with 2 entries + * @param m - The matrix. + * @param v - the axis vector + * @param axis - The axis 0 = x, 1 = y; + * @param dst - The matrix to set. If not passed a new one is created. + * @returns The matrix with axis set. + */ + function setAxis(m, v, axis, dst) { + const newDst = (dst === m ? m : copy(m, dst)); + const off = axis * 4; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + return newDst; + } + /** + * Returns the "2d" scaling component of the matrix * @param m - The Matrix * @param dst - The vector to set. If not passed a new one is created. */ function getScaling(m, dst) { - const newDst = (dst ?? new Ctor(3)); + const newDst = (dst ?? vec2.create()); + const xx = m[0]; + const xy = m[1]; + const yx = m[4]; + const yy = m[5]; + newDst[0] = Math.sqrt(xx * xx + xy * xy); + newDst[1] = Math.sqrt(yx * yx + yy * yy); + return newDst; + } + /** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ + function get3DScaling(m, dst) { + const newDst = (dst ?? vec3.create()); const xx = m[0]; const xy = m[1]; const xz = m[2]; @@ -2238,180 +2211,230 @@ function getAPIImpl$3(Ctor) { return newDst; } /** - * Rotate a 3D vector around the x-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector + * Creates a 3-by-3 matrix which translates by the given vector v. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translation matrix. */ - function rotateX(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); - //translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function translation(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; + } + /** + * Translates the given 3-by-3 matrix by the given vector v. + * @param m - The matrix. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translated matrix. + */ + function translate(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + const m00 = m[0]; + const m01 = m[1]; + const m02 = m[2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; + } + newDst[8] = m00 * v0 + m10 * v1 + m20; + newDst[9] = m01 * v0 + m11 * v1 + m21; + newDst[10] = m02 * v0 + m12 * v1 + m22; + return newDst; + } + /** + * Creates a 3-by-3 matrix which rotates by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotation(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Rotate a 3D vector around the y-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector + * Rotates the given 3-by-3 matrix by the given angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. */ - function rotateY(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); - // translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function rotate(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } return newDst; } /** - * Rotate a 3D vector around the z-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns {vec3} out + * Creates a 3-by-3 matrix which scales in each dimension by an amount given by + * the corresponding entry in the given vector; assumes the vector has three + * entries. + * @param v - A vector of + * 2 entries specifying the factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. */ - function rotateZ(a, b, rad, dst) { - const newDst = (dst ?? new Ctor(3)); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; - // translate to correct position - newDst[0] = r[0] + b[0]; - newDst[1] = r[1] + b[1]; - newDst[2] = r[2] + b[2]; + function scaling(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; return newDst; } /** - * Treat a 3D vector as a direction and set it's length - * - * @param a The vec3 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector + * Scales the given 3-by-3 matrix in each dimension by an amount + * given by the corresponding entry in the given vector; assumes the vector has + * three entries. + * @param m - The matrix to be modified. + * @param v - A vector of 2 entries specifying the + * factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. */ - function setLength(a, len, dst) { - const newDst = (dst ?? new Ctor(3)); - normalize(a, newDst); - return mulScalar(newDst, len, newDst); + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; } /** - * Ensure a vector is not longer than a max length - * - * @param a The vec3 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long + * Creates a 3-by-3 matrix which scales uniformly in each dimension + * @param s - Amount to scale + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. */ - function truncate(a, maxLen, dst) { - const newDst = (dst ?? new Ctor(3)); - if (length(a) > maxLen) { - return setLength(a, maxLen, newDst); - } - return copy(a, newDst); + function uniformScaling(s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 + * Scales the given 3-by-3 matrix in each dimension by an amount + * given. + * @param m - The matrix to be modified. + * @param s - Amount to scale. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. */ - function midpoint(a, b, dst) { - const newDst = (dst ?? new Ctor(3)); - return lerp(a, b, 0.5, newDst); + function uniformScale(m, s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; } return { + clone, create, - fromValues, set, - ceil, - floor, - round, - clamp, - add, - addScaled, - angle, - subtract, - sub, + fromMat4, + fromQuat, + negate, + copy, equalsApproximately, equals, - lerp, - lerpV, - max, - min, - mulScalar, - scale, - divScalar, + identity, + transpose, inverse, invert, - cross, - dot, - length, - len, - lengthSq, - lenSq, - distance, - dist, - distanceSq, - distSq, - normalize, - negate, - copy, - clone, - multiply, + determinant, mul, - divide, - div, - random, - zero, - transformMat4, - transformMat4Upper3x3, - transformMat3, - transformQuat, + multiply, + setTranslation, getTranslation, getAxis, + setAxis, getScaling, - rotateX, - rotateY, - rotateZ, - setLength, - truncate, - midpoint, + get3DScaling, + translation, + translate, + rotation, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, }; } const cache$3 = new Map(); @@ -2428,7 +2451,7 @@ function getAPI$3(Ctor) { * Generates a typed API for Mat4 * */ function getAPIImpl$2(Ctor) { - const vec3 = getAPI$3(Ctor); + const vec3 = getAPI$4(Ctor); /** * 4x4 Matrix math math functions. * @@ -3123,11 +3146,11 @@ function getAPIImpl$2(Ctor) { newDst[off + 2] = v[2]; return newDst; } - ///** - // * Returns the scaling component of the matrix - // * @param m - The Matrix - // * @param dst - The vector to set. If not passed a new one is created. - // */ + /** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ function getScaling(m, dst) { const newDst = (dst ?? vec3.create()); const xx = m[0]; @@ -4093,7 +4116,7 @@ function getAPI$2(Ctor) { * Generates am typed API for Qud * */ function getAPIImpl$1(Ctor) { - const vec3 = getAPI$3(Ctor); + const vec3 = getAPI$4(Ctor); /** * Creates a quat4; may be called with x, y, z to set initial values. * @param x - Initial x value. @@ -5541,7 +5564,7 @@ function getAPI(Ctor) { function wgpuMatrixAPI(Mat3Ctor, Mat4Ctor, QuatCtor, Vec2Ctor, Vec3Ctor, Vec4Ctor) { return { /** @namespace mat3 */ - mat3: getAPI$4(Mat3Ctor), + mat3: getAPI$3(Mat3Ctor), /** @namespace mat4 */ mat4: getAPI$2(Mat4Ctor), /** @namespace quat */ @@ -5549,7 +5572,7 @@ function wgpuMatrixAPI(Mat3Ctor, Mat4Ctor, QuatCtor, Vec2Ctor, Vec3Ctor, Vec4Cto /** @namespace vec2 */ vec2: getAPI$5(Vec2Ctor), /** @namespace vec3 */ - vec3: getAPI$3(Vec3Ctor), + vec3: getAPI$4(Vec3Ctor), /** @namespace vec4 */ vec4: getAPI(Vec4Ctor), }; diff --git a/dist/3.x/wgpu-matrix.module.js.map b/dist/3.x/wgpu-matrix.module.js.map index a12bd49..7fa2bd8 100644 --- a/dist/3.x/wgpu-matrix.module.js.map +++ b/dist/3.x/wgpu-matrix.module.js.map @@ -1 +1 @@ -{"version":3,"file":"wgpu-matrix.module.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat3API","getMat4API","getQuatAPI","getVec4API"],"mappings":";AAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;IAE7C,OAAO,cAAc,mBAAmB,CAAA;AACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;AACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;SACnC;AACG,KAAA,CAAC;AACT,CAAC;AAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAA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AAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE;AAE3E,MAAA;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;"} \ No newline at end of file +{"version":3,"file":"wgpu-matrix.module.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/vec3-impl.ts","../../../src/mat3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n const vec3 = getVec3API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n/**\n * Returns the \"2d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction get3DScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec3.create());\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n get3DScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat3API","getMat4API","getQuatAPI","getVec4API"],"mappings":";AAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;IAE7C,OAAO,cAAc,mBAAmB,CAAA;AACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;AACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;SACnC;AACG,KAAA,CAAC;AACT,CAAC;AAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;AClBvE;;;;;;;;;;;;;;;;;;;;AAoBG;AAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;AAE9B;;;;AAIG;AACG,SAAU,UAAU,CAAC,CAAS,EAAA;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC;IACpB,OAAO,GAAG,CAAC,CAAC;AACZ,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;AAIG;AACG,SAAU,Q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GG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK;AACX;;;AAGG;AACH,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;"} \ No newline at end of file diff --git a/dist/3.x/wgpu-matrix.module.min.js b/dist/3.x/wgpu-matrix.module.min.js index bd31313..7a02009 100644 --- a/dist/3.x/wgpu-matrix.module.min.js +++ b/dist/3.x/wgpu-matrix.module.min.js @@ -1,2 +1,2 @@ -const n=(t=Array,r=n=>n.fill(0),class extends t{constructor(...n){super(...n),r(this)}});var t,r;let e=1e-6;var o={__proto__:null,get EPSILON(){return e},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,r){const o=t-n;return Math.abs(t-n)1e-5?(e[0]=o/u,e[1]=c/u):(e[0]=0,e[1]=0),e}function l(t,r){const e=r??new n(2);return e[0]=t[0],e[1]=t[1],e}function w(t,r,e){const o=e??new n(2);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o}function m(t,r,e){const o=e??new n(2);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o}function d(t,r,e){const o=e??new n(2);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e){const o=e??new n(2);return o[0]=t,o[1]=r,o},ceil:function(t,r){const e=r??new n(2);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},floor:function(t,r){const e=r??new n(2);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},round:function(t,r){const e=r??new n(2);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(2);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c},add:function(t,r,e){const o=e??new n(2);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o},addScaled:function(t,r,e,o){const c=o??new n(2);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=t[0],c=t[1],u=Math.sqrt(r*r+e*e)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(2))}}}(n),c.set(n,t)),t}const a=new Map;function s(n){let t=a.get(n);return t||(t=function(n){const t=u(n);function r(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[8]=t[8],e[9]=t[9],e[10]=t[10],e}function o(t){const r=t??new n(12);return r[0]=1,r[1]=0,r[2]=0,r[4]=0,r[5]=1,r[6]=0,r[8]=0,r[9]=0,r[10]=1,r}function c(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],M=t[9],h=t[10],l=h*s-i*M,w=-h*a+i*f,m=M*a-s*f,d=1/(o*l+c*w+u*m);return e[0]=l*d,e[1]=(-h*c+u*M)*d,e[2]=(i*c-u*s)*d,e[4]=w*d,e[5]=(h*o-u*f)*d,e[6]=(-i*o+u*a)*d,e[8]=m*d,e[9]=(-M*o+c*f)*d,e[10]=(s*o-c*a)*d,e}function a(t,r,e){const o=e??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],M=t[8],h=t[9],l=t[10],w=r[0],m=r[1],d=r[2],v=r[4],p=r[5],q=r[6],b=r[8],g=r[9],x=r[10];return o[0]=c*w+s*m+M*d,o[1]=u*w+i*m+h*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*p+M*q,o[5]=u*v+i*p+h*q,o[6]=a*v+f*p+l*q,o[8]=c*b+s*g+M*x,o[9]=u*b+i*g+h*x,o[10]=a*b+f*g+l*x,o}return{clone:r,create:function(t,r,e,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==r&&(f[1]=r,void 0!==e&&(f[2]=e,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,r,e,o,c,u,a,s,i,f){const M=f??new n(12);return M[0]=t,M[1]=r,M[2]=e,M[3]=0,M[4]=o,M[5]=c,M[6]=u,M[7]=0,M[8]=a,M[9]=s,M[10]=i,M[11]=0,M},fromMat4:function(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0,e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=0,e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=0,e},fromQuat:function(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,M=o*s,h=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return e[0]=1-l-d,e[1]=h+q,e[2]=w-p,e[3]=0,e[4]=h-q,e[5]=1-M-d,e[6]=m+v,e[7]=0,e[8]=w+p,e[9]=m-v,e[10]=1-M-l,e[11]=0,e},negate:function(t,r){const e=r??new n(12);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e},copy:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])1e-5?(e[0]=o/a,e[1]=c/a,e[2]=u/a):(e[0]=0,e[1]=0,e[2]=0),e}function l(t,r){const e=r??new n(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function w(t,r,e){const o=e??new n(3);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o}function m(t,r,e){const o=e??new n(3);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o}function d(t,r,e){const o=e??new n(3);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o){const c=o??new n(3);return c[0]=t,c[1]=r,c[2]=e,c},ceil:function(t,r){const e=r??new n(3);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},floor:function(t,r){const e=r??new n(3);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},round:function(t,r){const e=r??new n(3);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(3);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c},add:function(t,r,e){const o=e??new n(3);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o},addScaled:function(t,r,e,o){const c=o??new n(3);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(r*r+e*e+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(3))}}}(n),i.set(n,t)),t}const M=new Map;function h(n){let t=M.get(n);return t||(t=function(n){const t=f(n);function r(t,r){const e=r??new n(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}const o=r;function c(t){const r=t??new n(16);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function u(t,r){const e=r??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=t[4],i=t[5],f=t[6],M=t[7],h=t[8],l=t[9],w=t[10],m=t[11],d=t[12],v=t[13],p=t[14],q=t[15],b=w*q,g=p*m,x=f*q,y=p*M,A=f*m,S=w*M,z=u*q,F=p*a,k=u*m,T=w*a,I=u*M,P=f*a,V=h*v,Z=d*l,L=s*v,R=d*i,E=s*l,X=h*i,Y=o*v,_=d*c,Q=o*l,N=h*c,U=o*i,j=s*c,D=b*i+y*l+A*v-(g*i+x*l+S*v),O=g*c+z*l+T*v-(b*c+F*l+k*v),$=x*c+F*i+I*v-(y*c+z*i+P*v),B=S*c+k*i+P*l-(A*c+T*i+I*l),C=1/(o*D+s*O+h*$+d*B);return e[0]=C*D,e[1]=C*O,e[2]=C*$,e[3]=C*B,e[4]=C*(g*s+x*h+S*d-(b*s+y*h+A*d)),e[5]=C*(b*o+F*h+k*d-(g*o+z*h+T*d)),e[6]=C*(y*o+z*s+P*d-(x*o+F*s+I*d)),e[7]=C*(A*o+T*s+I*h-(S*o+k*s+P*h)),e[8]=C*(V*M+R*m+E*q-(Z*M+L*m+X*q)),e[9]=C*(Z*a+Y*m+N*q-(V*a+_*m+Q*q)),e[10]=C*(L*a+_*M+U*q-(R*a+Y*M+j*q)),e[11]=C*(X*a+Q*M+j*m-(E*a+N*M+U*m)),e[12]=C*(L*w+X*p+Z*f-(E*p+V*f+R*w)),e[13]=C*(Q*p+V*u+_*w-(Y*w+N*p+Z*u)),e[14]=C*(Y*f+j*p+R*u-(U*p+L*u+_*f)),e[15]=C*(U*w+E*u+N*f-(Q*f+j*w+X*u)),e}const a=u;function s(t,r,e){const o=e??new n(16),c=t[0],u=t[1],a=t[2],s=t[3],i=t[4],f=t[5],M=t[6],h=t[7],l=t[8],w=t[9],m=t[10],d=t[11],v=t[12],p=t[13],q=t[14],b=t[15],g=r[0],x=r[1],y=r[2],A=r[3],S=r[4],z=r[5],F=r[6],k=r[7],T=r[8],I=r[9],P=r[10],V=r[11],Z=r[12],L=r[13],R=r[14],E=r[15];return o[0]=c*g+i*x+l*y+v*A,o[1]=u*g+f*x+w*y+p*A,o[2]=a*g+M*x+m*y+q*A,o[3]=s*g+h*x+d*y+b*A,o[4]=c*S+i*z+l*F+v*k,o[5]=u*S+f*z+w*F+p*k,o[6]=a*S+M*z+m*F+q*k,o[7]=s*S+h*z+d*F+b*k,o[8]=c*T+i*I+l*P+v*V,o[9]=u*T+f*I+w*P+p*V,o[10]=a*T+M*I+m*P+q*V,o[11]=s*T+h*I+d*P+b*V,o[12]=c*Z+i*L+l*R+v*E,o[13]=u*Z+f*L+w*R+p*E,o[14]=a*Z+M*L+m*R+q*E,o[15]=s*Z+h*L+d*R+b*E,o}const i=s,M=t.create(),h=t.create(),l=t.create();function w(t,r,e){const o=e??new n(16);let c=t[0],u=t[1],a=t[2];const s=Math.sqrt(c*c+u*u+a*a);c/=s,u/=s,a/=s;const i=c*c,f=u*u,M=a*a,h=Math.cos(r),l=Math.sin(r),w=1-h;return o[0]=i+(1-i)*h,o[1]=c*u*w+a*l,o[2]=c*a*w-u*l,o[3]=0,o[4]=c*u*w-a*l,o[5]=f+(1-f)*h,o[6]=u*a*w+c*l,o[7]=0,o[8]=c*a*w+u*l,o[9]=u*a*w-c*l,o[10]=M+(1-M)*h,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function m(t,r,e,o){const c=o??new n(16);let u=r[0],a=r[1],s=r[2];const i=Math.sqrt(u*u+a*a+s*s);u/=i,a/=i,s/=i;const f=u*u,M=a*a,h=s*s,l=Math.cos(e),w=Math.sin(e),m=1-l,d=f+(1-f)*l,v=u*a*m+s*w,p=u*s*m-a*w,q=u*a*m-s*w,b=M+(1-M)*l,g=a*s*m+u*w,x=u*s*m+a*w,y=a*s*m-u*w,A=h+(1-h)*l,S=t[0],z=t[1],F=t[2],k=t[3],T=t[4],I=t[5],P=t[6],V=t[7],Z=t[8],L=t[9],R=t[10],E=t[11];return c[0]=d*S+v*T+p*Z,c[1]=d*z+v*I+p*L,c[2]=d*F+v*P+p*R,c[3]=d*k+v*V+p*E,c[4]=q*S+b*T+g*Z,c[5]=q*z+b*I+g*L,c[6]=q*F+b*P+g*R,c[7]=q*k+b*V+g*E,c[8]=x*S+y*T+A*Z,c[9]=x*z+y*I+A*L,c[10]=x*F+y*P+A*R,c[11]=x*k+y*V+A*E,t!==c&&(c[12]=t[12],c[13]=t[13],c[14]=t[14],c[15]=t[15]),c}return{create:function(t,r,e,o,c,u,a,s,i,f,M,h,l,w,m,d){const v=new n(16);return void 0!==t&&(v[0]=t,void 0!==r&&(v[1]=r,void 0!==e&&(v[2]=e,void 0!==o&&(v[3]=o,void 0!==c&&(v[4]=c,void 0!==u&&(v[5]=u,void 0!==a&&(v[6]=a,void 0!==s&&(v[7]=s,void 0!==i&&(v[8]=i,void 0!==f&&(v[9]=f,void 0!==M&&(v[10]=M,void 0!==h&&(v[11]=h,void 0!==l&&(v[12]=l,void 0!==w&&(v[13]=w,void 0!==m&&(v[14]=m,void 0!==d&&(v[15]=d)))))))))))))))),v},set:function(t,r,e,o,c,u,a,s,i,f,M,h,l,w,m,d,v){const p=v??new n(16);return p[0]=t,p[1]=r,p[2]=e,p[3]=o,p[4]=c,p[5]=u,p[6]=a,p[7]=s,p[8]=i,p[9]=f,p[10]=M,p[11]=h,p[12]=l,p[13]=w,p[14]=m,p[15]=d,p},fromMat3:function(t,r){const e=r??new n(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0,e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=0,e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},fromQuat:function(t,r){const e=r??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,M=o*s,h=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return e[0]=1-l-d,e[1]=h+q,e[2]=w-p,e[3]=0,e[4]=h-q,e[5]=1-M-d,e[6]=m+v,e[7]=0,e[8]=w+p,e[9]=m-v,e[10]=1-M-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},negate:function(t,r){const e=r??new n(16);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},copy:r,clone:o,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e){const n=Math.acos(v),t=Math.sin(n);M=Math.sin((1-o)*n)/t,h=Math.sin(o*n)/t}else M=1-o,h=o;return u[0]=M*a+h*l,u[1]=M*s+h*w,u[2]=M*i+h*m,u[3]=M*f+h*d,u}function i(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}const M=i;function h(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}const l=h;function w(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}const p=v;function q(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}const b=q;function g(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=1),e}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:r,fromValues:o,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,r){const o=r??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>e?(o[0]=n[0]/u,o[1]=n[1]/u,o[2]=n[2]/u):(o[0]=1,o[1]=0,o[2]=0),{angle:c,axis:o}},angle:function(n,t){const r=d(n,t);return Math.acos(2*r*r-1)},multiply:u,mul:a,rotateX:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+i*f,o[1]=a*M+s*f,o[2]=s*M-a*f,o[3]=i*M-u*f,o},rotateY:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M-s*f,o[1]=a*M+i*f,o[2]=s*M+u*f,o[3]=i*M-a*f,o},rotateZ:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+a*f,o[1]=a*M-u*f,o[2]=s*M+i*f,o[3]=i*M-s*f,o},slerp:s,inverse:function(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return e[0]=-o*i,e[1]=-c*i,e[2]=-u*i,e[3]=a*i,e},conjugate:function(t,r){const e=r??new n(4);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},fromMat:function(t,r){const e=r??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);e[3]=.5*n;const r=.5/n;e[0]=(t[6]-t[9])*r,e[1]=(t[8]-t[2])*r,e[2]=(t[1]-t[4])*r}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const r=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*r+r]-t[4*o+o]+1);e[n]=.5*c;const u=.5/c;e[3]=(t[4*r+o]-t[4*o+r])*u,e[r]=(t[4*r+n]+t[4*n+r])*u,e[o]=(t[4*o+n]+t[4*n+o])*u}return e},fromEuler:function(t,r,e,o,c){const u=c??new n(4),a=.5*t,s=.5*r,i=.5*e,f=Math.sin(a),M=Math.cos(a),h=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"xzy":u[0]=f*l*m-M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m+f*h*w;break;case"yxz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;case"yzx":u[0]=f*l*m+M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m-f*h*w;break;case"zxy":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"zyx":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:i,clone:M,add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},subtract:h,sub:l,mulScalar:w,scale:m,divScalar:function(t,r,e){const o=e??new n(4);return o[0]=t[0]/r,o[1]=t[1]/r,o[2]=t[2]/r,o[3]=t[3]/r,o},dot:d,lerp:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c},length:v,len:p,lengthSq:q,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(r,e,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,r,e,o,c,u){const a=u??new n(4);return s(t,o,c,S),s(r,e,c,z),s(S,z,2*c*(1-c),a),a}}}(n),l.set(n,t)),t}const m=new Map;function d(n){let t=m.get(n);return t||(t=function(n){function t(t,r,e,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==r&&(c[1]=r,void 0!==e&&(c[2]=e,void 0!==o&&(c[3]=o)))),c}function r(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}function o(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c}function c(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}function u(t,r){const e=r??new n(4);return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function a(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function s(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function i(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(r*r+e*e+o*o+c*c)}function f(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return r*r+e*e+o*o+c*c}function M(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function h(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(t,r,e){const o=e??new n(4);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o[3]=t[3]*r[3],o}function w(t,r,e){const o=e??new n(4);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o[3]=t[3]/r[3],o}function m(t,r,e){const o=e??new n(4);return M(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},ceil:function(t,r){const e=r??new n(4);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},floor:function(t,r){const e=r??new n(4);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},round:function(t,r){const e=r??new n(4);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(4);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c[3]=Math.min(e,Math.max(r,t[3])),c},add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},addScaled:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c[3]=t[3]+r[3]*e,c},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?m(t,r,o):h(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(4))}}}(n),m.set(n,t)),t}function v(n,t,r,e,o,c){return{mat3:s(n),mat4:h(t),quat:w(r),vec2:u(e),vec3:f(o),vec4:d(c)}}const{mat3:p,mat4:q,quat:b,vec2:g,vec3:x,vec4:y}=v(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat3:A,mat4:S,quat:z,vec2:F,vec3:k,vec4:T}=v(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat3:I,mat4:P,quat:V,vec2:Z,vec3:L,vec4:R}=v(n,Array,Array,Array,Array,Array);export{p as mat3,A as mat3d,I as mat3n,q as mat4,S as mat4d,P as mat4n,b as quat,z as quatd,V as quatn,o as utils,g as vec2,F as vec2d,Z as vec2n,x as vec3,k as vec3d,L as vec3n,y as vec4,T as vec4d,R as vec4n}; +const n=(t=Array,r=n=>n.fill(0),class extends t{constructor(...n){super(...n),r(this)}});var t,r;let e=1e-6;var o={__proto__:null,get EPSILON(){return e},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,r){const o=t-n;return Math.abs(t-n)1e-5?(e[0]=o/u,e[1]=c/u):(e[0]=0,e[1]=0),e}function l(t,r){const e=r??new n(2);return e[0]=t[0],e[1]=t[1],e}function w(t,r,e){const o=e??new n(2);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o}function m(t,r,e){const o=e??new n(2);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o}function d(t,r,e){const o=e??new n(2);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e){const o=e??new n(2);return o[0]=t,o[1]=r,o},ceil:function(t,r){const e=r??new n(2);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},floor:function(t,r){const e=r??new n(2);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},round:function(t,r){const e=r??new n(2);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(2);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c},add:function(t,r,e){const o=e??new n(2);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o},addScaled:function(t,r,e,o){const c=o??new n(2);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=t[0],c=t[1],u=Math.sqrt(r*r+e*e)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(2))}}}(n),c.set(n,t)),t}const a=new Map;function s(n){let t=a.get(n);return t||(t=function(n){function t(t,r,e){const o=new n(3);return void 0!==t&&(o[0]=t,void 0!==r&&(o[1]=r,void 0!==e&&(o[2]=e))),o}function r(t,r,e){const o=e??new n(3);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o}function o(t,r,e,o){const c=o??new n(3);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c}function c(t,r,e){const o=e??new n(3);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o}function u(t,r){const e=r??new n(3);return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function a(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function s(n){const t=n[0],r=n[1],e=n[2];return Math.sqrt(t*t+r*r+e*e)}function i(n){const t=n[0],r=n[1],e=n[2];return t*t+r*r+e*e}function f(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2];return Math.sqrt(r*r+e*e+o*o)}function M(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2];return r*r+e*e+o*o}function h(t,r){const e=r??new n(3),o=t[0],c=t[1],u=t[2],a=Math.sqrt(o*o+c*c+u*u);return a>1e-5?(e[0]=o/a,e[1]=c/a,e[2]=u/a):(e[0]=0,e[1]=0,e[2]=0),e}function l(t,r){const e=r??new n(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function w(t,r,e){const o=e??new n(3);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o}function m(t,r,e){const o=e??new n(3);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o}function d(t,r,e){const o=e??new n(3);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o){const c=o??new n(3);return c[0]=t,c[1]=r,c[2]=e,c},ceil:function(t,r){const e=r??new n(3);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},floor:function(t,r){const e=r??new n(3);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},round:function(t,r){const e=r??new n(3);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(3);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c},add:function(t,r,e){const o=e??new n(3);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o},addScaled:function(t,r,e,o){const c=o??new n(3);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(r*r+e*e+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(3))}}}(n),a.set(n,t)),t}const i=new Map;function f(n){let t=i.get(n);return t||(t=function(n){const t=u(n),r=s(n);function o(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[8]=t[8],e[9]=t[9],e[10]=t[10],e}function c(t){const r=t??new n(12);return r[0]=1,r[1]=0,r[2]=0,r[4]=0,r[5]=1,r[6]=0,r[8]=0,r[9]=0,r[10]=1,r}function a(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],M=t[9],h=t[10],l=h*s-i*M,w=-h*a+i*f,m=M*a-s*f,d=1/(o*l+c*w+u*m);return e[0]=l*d,e[1]=(-h*c+u*M)*d,e[2]=(i*c-u*s)*d,e[4]=w*d,e[5]=(h*o-u*f)*d,e[6]=(-i*o+u*a)*d,e[8]=m*d,e[9]=(-M*o+c*f)*d,e[10]=(s*o-c*a)*d,e}function i(t,r,e){const o=e??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],M=t[8],h=t[9],l=t[10],w=r[0],m=r[1],d=r[2],v=r[4],q=r[5],p=r[6],b=r[8],g=r[9],x=r[10];return o[0]=c*w+s*m+M*d,o[1]=u*w+i*m+h*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*q+M*p,o[5]=u*v+i*q+h*p,o[6]=a*v+f*q+l*p,o[8]=c*b+s*g+M*x,o[9]=u*b+i*g+h*x,o[10]=a*b+f*g+l*x,o}return{clone:o,create:function(t,r,e,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==r&&(f[1]=r,void 0!==e&&(f[2]=e,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,r,e,o,c,u,a,s,i,f){const M=f??new n(12);return M[0]=t,M[1]=r,M[2]=e,M[3]=0,M[4]=o,M[5]=c,M[6]=u,M[7]=0,M[8]=a,M[9]=s,M[10]=i,M[11]=0,M},fromMat4:function(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0,e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=0,e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=0,e},fromQuat:function(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,M=o*s,h=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,q=a*i,p=a*f;return e[0]=1-l-d,e[1]=h+p,e[2]=w-q,e[3]=0,e[4]=h-p,e[5]=1-M-d,e[6]=m+v,e[7]=0,e[8]=w+q,e[9]=m-v,e[10]=1-M-l,e[11]=0,e},negate:function(t,r){const e=r??new n(12);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e},copy:o,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e){const n=Math.acos(v),t=Math.sin(n);M=Math.sin((1-o)*n)/t,h=Math.sin(o*n)/t}else M=1-o,h=o;return u[0]=M*a+h*l,u[1]=M*s+h*w,u[2]=M*i+h*m,u[3]=M*f+h*d,u}function f(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}const M=f;function h(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}const l=h;function w(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}const q=v;function p(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}const b=p;function g(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=1),e}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:r,fromValues:o,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,r){const o=r??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>e?(o[0]=n[0]/u,o[1]=n[1]/u,o[2]=n[2]/u):(o[0]=1,o[1]=0,o[2]=0),{angle:c,axis:o}},angle:function(n,t){const r=d(n,t);return Math.acos(2*r*r-1)},multiply:u,mul:a,rotateX:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+i*f,o[1]=a*M+s*f,o[2]=s*M-a*f,o[3]=i*M-u*f,o},rotateY:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M-s*f,o[1]=a*M+i*f,o[2]=s*M+u*f,o[3]=i*M-a*f,o},rotateZ:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+a*f,o[1]=a*M-u*f,o[2]=s*M+i*f,o[3]=i*M-s*f,o},slerp:i,inverse:function(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return e[0]=-o*i,e[1]=-c*i,e[2]=-u*i,e[3]=a*i,e},conjugate:function(t,r){const e=r??new n(4);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},fromMat:function(t,r){const e=r??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);e[3]=.5*n;const r=.5/n;e[0]=(t[6]-t[9])*r,e[1]=(t[8]-t[2])*r,e[2]=(t[1]-t[4])*r}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const r=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*r+r]-t[4*o+o]+1);e[n]=.5*c;const u=.5/c;e[3]=(t[4*r+o]-t[4*o+r])*u,e[r]=(t[4*r+n]+t[4*n+r])*u,e[o]=(t[4*o+n]+t[4*n+o])*u}return e},fromEuler:function(t,r,e,o,c){const u=c??new n(4),a=.5*t,s=.5*r,i=.5*e,f=Math.sin(a),M=Math.cos(a),h=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"xzy":u[0]=f*l*m-M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m+f*h*w;break;case"yxz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;case"yzx":u[0]=f*l*m+M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m-f*h*w;break;case"zxy":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"zyx":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:f,clone:M,add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},subtract:h,sub:l,mulScalar:w,scale:m,divScalar:function(t,r,e){const o=e??new n(4);return o[0]=t[0]/r,o[1]=t[1]/r,o[2]=t[2]/r,o[3]=t[3]/r,o},dot:d,lerp:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c},length:v,len:q,lengthSq:p,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(r,e,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,r,e,o,c,u){const a=u??new n(4);return i(t,o,c,S),i(r,e,c,z),i(S,z,2*c*(1-c),a),a}}}(n),l.set(n,t)),t}const m=new Map;function d(n){let t=m.get(n);return t||(t=function(n){function t(t,r,e,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==r&&(c[1]=r,void 0!==e&&(c[2]=e,void 0!==o&&(c[3]=o)))),c}function r(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}function o(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c}function c(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}function u(t,r){const e=r??new n(4);return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function a(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function s(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function i(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(r*r+e*e+o*o+c*c)}function f(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return r*r+e*e+o*o+c*c}function M(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function h(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(t,r,e){const o=e??new n(4);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o[3]=t[3]*r[3],o}function w(t,r,e){const o=e??new n(4);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o[3]=t[3]/r[3],o}function m(t,r,e){const o=e??new n(4);return M(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},ceil:function(t,r){const e=r??new n(4);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},floor:function(t,r){const e=r??new n(4);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},round:function(t,r){const e=r??new n(4);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(4);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c[3]=Math.min(e,Math.max(r,t[3])),c},add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},addScaled:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c[3]=t[3]+r[3]*e,c},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?m(t,r,o):h(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(4))}}}(n),m.set(n,t)),t}function v(n,t,r,e,o,c){return{mat3:f(n),mat4:h(t),quat:w(r),vec2:u(e),vec3:s(o),vec4:d(c)}}const{mat3:q,mat4:p,quat:b,vec2:g,vec3:x,vec4:y}=v(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat3:A,mat4:S,quat:z,vec2:F,vec3:k,vec4:T}=v(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat3:I,mat4:P,quat:V,vec2:Z,vec3:L,vec4:R}=v(n,Array,Array,Array,Array,Array);export{q as mat3,A as mat3d,I as mat3n,p as mat4,S as mat4d,P as mat4n,b as quat,z as quatd,V as quatn,o as utils,g as vec2,F as vec2d,Z as vec2n,x as vec3,k as vec3d,L as vec3n,y as vec4,T as vec4d,R as vec4n}; //# sourceMappingURL=wgpu-matrix.module.min.js.map diff --git a/dist/3.x/wgpu-matrix.module.min.js.map b/dist/3.x/wgpu-matrix.module.min.js.map index 685e076..c2d1801 100644 --- a/dist/3.x/wgpu-matrix.module.min.js.map +++ b/dist/3.x/wgpu-matrix.module.min.js.map @@ -1 +1 @@ -{"version":3,"file":"wgpu-matrix.module.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","vec2","getVec2API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","transpose","determinant","setTranslation","getTranslation","getAxis","axis","off","setAxis","getScaling","xy","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","dz","az","bz","t1","t2","zScale","transformMat4Upper3x3","transformQuat","qx","qy","qz","w2","uvX","uvY","uvZ","xz","yz","rotateX","p","r","rotateY","rotateZ","vec3","getVec3API","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat3","getMat3API","mat4","getMat4API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat3d","mat4d","quatd","vec2d","vec3d","vec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aAAcA,aAAcA,eAOxER,KAAMS,EAKNP,KAAMQ,EAKNN,KAAMO,EAKN3Q,KAAM4Q,EAKN5K,KAAM6K,EAKNP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxEf,KAAMgB,EAKNd,KAAMe,EAKNb,KAAMc,EAKNlR,KAAMmR,EAKNnL,KAAMoL,EAKNd,KAAMe,GACJ5B,EAEAnW,EAAWgY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file +{"version":3,"file":"wgpu-matrix.module.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/vec3-impl.ts","../../../src/mat3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n const vec3 = getVec3API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n/**\n * Returns the \"2d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction get3DScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec3.create());\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n get3DScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n/**\n * Returns the \"3d\" scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","/**\n * Some docs\n * @namespace wgpu-matrix\n */\nimport {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat3 */\n mat3: getMat3API(Mat3Ctor),\n /** @namespace mat4 */\n mat4: getMat4API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat3,\n /**\n * 4x4 Matrix functions that default to returning `Float32Array`\n * @namespace\n */\n mat4,\n /**\n * Quaternion functions that default to returning `Float32Array`\n * @namespace\n */\n quat,\n /**\n * Vec2 functions that default to returning `Float32Array`\n * @namespace\n */\n vec2,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec3,\n /**\n * Vec3 functions that default to returning `Float32Array`\n * @namespace\n */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat3: mat3d,\n /**\n * 4x4 Matrix functions that default to returning `Float64Array`\n * @namespace\n */\n mat4: mat4d,\n /**\n * Quaternion functions that default to returning `Float64Array`\n * @namespace\n */\n quat: quatd,\n /**\n * Vec2 functions that default to returning `Float64Array`\n * @namespace\n */\n vec2: vec2d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec3: vec3d,\n /**\n * Vec3 functions that default to returning `Float64Array`\n * @namespace\n */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /**\n * 3x3 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat3: mat3n,\n /**\n * 4x4 Matrix functions that default to returning `number[]`\n * @namespace\n */\n mat4: mat4n,\n /**\n * Quaternion functions that default to returning `number[]`\n * @namespace\n */\n quat: quatn,\n /**\n * Vec2 functions that default to returning `number[]`\n * @namespace\n */\n vec2: vec2n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec3: vec3n,\n /**\n * Vec3 functions that default to returning `number[]`\n * @namespace\n */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","v2","dz","az","bz","t1","t2","zScale","w","transformMat4Upper3x3","transformQuat","q","qx","qy","qz","w2","uvX","uvY","uvZ","getTranslation","getAxis","axis","off","getScaling","xx","xy","xz","yx","yy","yz","zx","zy","zz","rotateX","p","r","rotateY","rotateZ","vec2","getVec2API","vec3","getVec3API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","x2","y2","z2","wx","wy","wz","transpose","determinant","setTranslation","setAxis","get3DScaling","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat3","getMat3API","mat4","getMat4API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat3d","mat4d","quatd","vec2d","vec3d","vec4d","Float64Array","mat3n","mat4n","quatn","vec2n","vec3n","vec4n","Array"],"mappings":"AAkBO,MAAMA,GAXXC,EAWsC,MAVtCC,EAUsDC,GAAKA,EAAEC,KAAK,GAR3D,cAAcH,EACnB,WAAAI,IAAeC,GACbC,SAASD,GACTJ,EAASM,KACV,IARL,IACEP,EACAC,ECcK,IAAIO,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,u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,KAKJA,EAAIhO,KAKJA,EAAIE,KAKJA,EAAIgO,KAKJA,GACEb,EAEAe,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxER,KAAMS,EAKNP,KAAMQ,EAKNN,KAAMO,EAKNvO,KAAMwO,EAKNtO,KAAMuO,EAKNP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAOxEf,KAAMgB,EAKNd,KAAMe,EAKNb,KAAMc,EAKN9O,KAAM+O,EAKN7O,KAAM8O,EAKNd,KAAMe,GACJ5B,EAEApW,EAAWiY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 4fc2484..65ff8c5 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA7WdQZPbxhFG/8ueFTtWd5KKb5tEh1TJcSIpKjsuH+BtaIWYbHBBcGvllP97CgDBBUVMT3O+9lHAdAscgtjv1TwOf/jfTV8/9Tdf32yrnm5e3Oyq/uPwr1YOm3r/5XD0i4/9dnPz4ubnRuXma35xc/ex2UhX683XP5zK7zat1s/1Hw561zetHjuMZ8/7/JF/ffFc3e4+pYvb3Sertqur3vivx9NGvdR93W0brbRPNlmMMTrVD4dqs082mU5n6293u659arZVX2/Sk7Iy1uj8oWu331Q9J9vNAzI9/nWo0pM0DzB63Nf97VOTnqLjebvD27tq0+i91eQ4xO7zrqt0v6mGSqvXYpjRr5Fa+6ZPv2HzAKuHPtbdPn0rH8/nOqTfoem0Ub89bJLF28PGruybnXHDzgOMHlrfW5/k6bRR37W9VT+dztVbd8M8wOixv6s26UsYz2aqrVt7n72v93X67d/X1nu/z3w299nP5t73mdp7P1P9cVR6Pk8jHF2sS+r917NrjU/oaYTR5aDNh7bbvjVvlOUgXy/rtjkfdtHvx+XnuOpJ1nOA4EFAoCQgWBSQkCwgIWFAQtOABMcBicgD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XLa+Usq9yfb7YN1+cmC92zhevzRf75ovX5osd83WuhU2lwzFf5cp8HQ97qtfmaz7uqb+Yr/Gg78ov5ms8mK99c/yx9W87qS8+1Gcnc53en/0s89RgOJa/hmHUyswfD3uq12Z+Pu6pv5j58aDvyi9mfjzoqr14Eg7HfJXr8+V5Eg7DEvPlehK+P9+A5rnYN1+XT8LxoKv24kk4HPNVrs+X50k4DEvMl+tJ+P58Ffq52Ddfl0/C8WCq9sf/A7RSHgkj2gAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA7WdQZPbxhFG/8ueFTtWd5KKb5tYh1TJcSIpKjsuH+BtaIWYbHBBcGvlVP57CgDBBUVMT3O+9lHAdAscgtjv1TwOf/zvTV8/9Tdf32yrnm5e3Oyq/uPwr1YOm3r/5XD0i4/9dnPz4uaXRuXma35xc/ex2UhX683XP57K7zat1s/1Hw561zetHjuMZ8/7/JH/9+K5ut19She3u09WbVdXvfFfj6eNeqn7uts2WmmfbLIYY3SqHw7VZp9sMp3O1t/udl371Gyrvt6kJ2VlrNH5Q9duv616TrabB2R6/PNQpSdpHmD0uK97+ubtXbVp9D7ZZznI7nX71KSn+3je7uC4FteVvOsq3W+qodLqtRhm9Guk1r7p02/+PMDqoY91t09/LI7ncx3S7/Z02qjfHjbJ4u1hY1f2zc64+ecBRg+t762nwnTaqO/a3qqfTufqrbthHmD02N9Vm/QljGcz1datvc/e1/s6/fbva+u932c+m/vsZ3Pv+0ztvZ+p/jgqPZ+nEY4u1iX1/uvZtcYn9DTC6HLQ5kPbbd+aN8pykK+XdducD7vo99Pyc1z1JOuZQvBQIVCqECxWSEiukJBgIaHJQoKjhURkC4kKFxKULiQkXkhkvpC4gCEBCUPgiCFQxhAwZAieMgSNGYLnDIGDhqBJQ7CoIVjWkLCwIYFpQ6LihkTlDQkLHBKbOOTayKHrkUPxyKFQ5FAscmhI5NCQyKGhkUODI4dGRA6NihwaFDk0JHJoZOTQuMihAZFD4cihUORQMHIo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486Kq9eBIOx3yV6/PleRIOwxLz5XoSvj/fgOa52Ddfl0/C8aCr9uJJOBzzVa7Pl+dJOAxLzJfrSfj+fBX6udg3X5dPwvFgqvan/wOr+VFnCdsAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 8be40f5..d0c956c 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62d23Lsyo2m30V9q1muPJP7zj3TFx3RnkO3xzE9KxwOWVVeVrdUpa3Dnm07/O4TTBa4SPAHiGTtKymqikgewEwAX2b+f7t7u/y/97sfvv7t7j+fzse7H/yhLy75+7vzw8vp7oe7f3x4P/3Xj8vb3f3d59vz3Q93H395Pb3/ij7+8uePl+e7+7vH54f399P73Q93d3+/J1vJfbfzhz8MB2pW/mH6yczY/d3rw9vp/DE/k+8N8JP9zcNHYE0MH/0Xp54msBLXVmKjlf/1+fDBrAwfNVr53enRMyvDR+1W+H0ZPmq3wu/L8FH73Q1H8JCOO54SsBNb7QwPhdupn+14UtxO/WzHswJ2mu/P8GiAneb7MzybM3he5x3PC9iJrXaGZ8Pt1M92PC9up36243kBO833Z3g2wM7m/YmThZd57/dyOX4+n95/NXyoHp+/G3h8vpy/d9F/+jw/fjxdzlcb9UtgadZD1xPAlt9ODx+y6frtXtvvpw/J8PvpY6/VP71dXhYDATNN399ifzFEAPvD93vtn0/flDs+frv7aV5e/yI+y8vrX/baPf34+fD8/uvX17fLz08vDx+nZ7EZ8NPbWtUb2mv76Xg6fzx9iJdB3++1//H2cH5/vbyLD3r6we4rOP90epPtX7++ybr4Dozf7rV9PH2c3l6ezg9nsYHZT/a28vL5LFl/+Xy+werH06vs/vT9DX3mbwfPeH4YjCrd5+xXe9v6Zmrr2y/V1q9/fhJf5uvXN9w1zfr7bda/nT7+7fHh+en8TTn96y9u6i/0B/Fx+1MgE3qv9HzDCPR2+VAvgr6/yb54+uO3u71If8jvtz3h4XDxxOuX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CKX4xTon4uODJJ/OnNTG1iZcFmxdUl/7T5W01m2PY6Wf2rk28epo1OGHqabIgBcrZ1vHOm47LpucPoptiwek1n0oj5Cr99JpP9Q+KBfP0mtscY3FWn6+vp7fw8/LGuPkE7YkFTsAvN954nuwOOyTN7E8l76m2ZvSaa1+1DBRmpqmKQY82TD3J9GinLsU4zVLoH+PshlE8MBUhp+z5e4GRhkBj8bC2+nphFH8WT06TM8mJ6VmFaX7hNEvOWAT8ePs8P7KbOyzOnrkt1fio+OGnFXDkpImSrkSdX6EOslDS1RkD1M/z0+BM69Bw1kvQc51WP9AbG6aVDTSCZuM8vVmzPGqbdR/0aKeKIL2dYSr70e3KxukInx9Py2mjbs6uOmM69tPp0S/ym9kMtmuvb6wQDZZWlaZ53GPsjwc7bPnCfFCiMdmWHw7GlqHYvE+fIhWbhw3G1pWmeS0h2uKZn06Piw511tlTpdwIwAZLq5s+X+1hXNs62Fne9MWUC3ptzTedQdVF0Eovuvmmr6HqfOJNF81ntRhj52icOirz41tT1XmdMNgGqMHO8qbPJ+RMJM/WDw3Gljd93hdPIb/9zNY3fV6fibbu5a+nt+VU6MOcrNLo6mkU8hQixmlFJMWciTKaQqFmoVCzc4ar+v393evT6+n56Xy6++Hr7//+9/8Pc9r91KVJAgA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62dXZPjynGm/0v7tnfM+i6eO3ntC0dY611bq1jvhELRGlKjtrvZc/rj7JEU+u8bKDAxQOLNRBZ47hgkkQUUElWZ+RTq/evd68v/e7v74fNf7/7r8XK6+8EfjsUlf393eXg+3/1w9w8Pb+f//v7yend/9/H6dPfD3fufv53f/p6+/vSn9+enu/u7L08Pb2/nt7sf7u7+dk+2kvtu5/e/Hw7UrPzd9JeZsfu7bw+v58v7/Ey+N8BP9tcP74E1MXz135x6msBKXFuJnVb+18fDO7MyfNVp5bfnL55ZGb7qt8L7Zfiq3wrvl+Gr/t4NJ3CTTjvuErATe+0MN4Xbad/tuFPc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8uF6W6OUqpxnzsp/MXv0hwZp11HfWNWG6wtCo1zeMe43g82GFvR8wne5qTbZHDYGwZis0H1mlFms3DBmPrUtO8mBDNZ7UYUGe9ROUI47LPwdKq0+cvkxhfnR3sLDt9Qd7psbVf3rLTFxMpPejmTl9T1flLLjWau2oxx87fIqSByvbID5ZWnT4vFEbbBDXYWXb6fKHLFMDbhoPB2LLT59HR9Eai/czWnT4v0ETb8PKX8+tyofVhXuqtU82NPlBGE6fF0hQeJ8poyuRBFBVXb7iq393ffXv8dn56vJzvfvj8u7/97f8DyFDAX7JMAgA="; \ No newline at end of file diff --git a/docs/functions/mat3.get3DScaling.html b/docs/functions/mat3.get3DScaling.html new file mode 100644 index 0000000..149b90e --- /dev/null +++ b/docs/functions/mat3.get3DScaling.html @@ -0,0 +1,4 @@ +get3DScaling | wgpu-matrix

Function get3DScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns Float32Array | T

\ No newline at end of file diff --git a/docs/functions/mat3.getScaling.html b/docs/functions/mat3.getScaling.html index 3e0046b..284b76d 100644 --- a/docs/functions/mat3.getScaling.html +++ b/docs/functions/mat3.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns Float32Array | T

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "2d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns Float32Array | T

\ No newline at end of file diff --git a/docs/functions/mat3d.get3DScaling.html b/docs/functions/mat3d.get3DScaling.html new file mode 100644 index 0000000..9b9e2bb --- /dev/null +++ b/docs/functions/mat3d.get3DScaling.html @@ -0,0 +1,4 @@ +get3DScaling | wgpu-matrix

Function get3DScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns Float64Array | T

\ No newline at end of file diff --git a/docs/functions/mat3d.getScaling.html b/docs/functions/mat3d.getScaling.html index 40c6969..a294b87 100644 --- a/docs/functions/mat3d.getScaling.html +++ b/docs/functions/mat3d.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns Float64Array | T

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "2d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns Float64Array | T

\ No newline at end of file diff --git a/docs/functions/mat3n.get3DScaling.html b/docs/functions/mat3n.get3DScaling.html new file mode 100644 index 0000000..fb7eb0c --- /dev/null +++ b/docs/functions/mat3n.get3DScaling.html @@ -0,0 +1,4 @@ +get3DScaling | wgpu-matrix

Function get3DScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns number[] | T

\ No newline at end of file diff --git a/docs/functions/mat3n.getScaling.html b/docs/functions/mat3n.getScaling.html index ab4d506..cbbde21 100644 --- a/docs/functions/mat3n.getScaling.html +++ b/docs/functions/mat3n.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns number[] | T

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "2d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns number[] | T

\ No newline at end of file diff --git a/docs/functions/mat4.getScaling.html b/docs/functions/mat4.getScaling.html index 62864ed..be46de1 100644 --- a/docs/functions/mat4.getScaling.html +++ b/docs/functions/mat4.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/functions/mat4d.getScaling.html b/docs/functions/mat4d.getScaling.html index 753d45e..aec7d9f 100644 --- a/docs/functions/mat4d.getScaling.html +++ b/docs/functions/mat4d.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/functions/mat4n.getScaling.html b/docs/functions/mat4n.getScaling.html index a599af7..0bf2787 100644 --- a/docs/functions/mat4n.getScaling.html +++ b/docs/functions/mat4n.getScaling.html @@ -1 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the "3d" scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/modules/mat3.html b/docs/modules/mat3.html index 4c9acd3..473f8e9 100644 --- a/docs/modules/mat3.html +++ b/docs/modules/mat3.html @@ -7,6 +7,7 @@ equalsApproximately fromMat4 fromQuat +get3DScaling getAxis getScaling getTranslation diff --git a/docs/modules/mat3d.html b/docs/modules/mat3d.html index 29b9d70..7460727 100644 --- a/docs/modules/mat3d.html +++ b/docs/modules/mat3d.html @@ -7,6 +7,7 @@ equalsApproximately fromMat4 fromQuat +get3DScaling getAxis getScaling getTranslation diff --git a/docs/modules/mat3n.html b/docs/modules/mat3n.html index dc40657..cf9360c 100644 --- a/docs/modules/mat3n.html +++ b/docs/modules/mat3n.html @@ -7,6 +7,7 @@ equalsApproximately fromMat4 fromQuat +get3DScaling getAxis getScaling getTranslation diff --git a/package-lock.json b/package-lock.json index 6d8d13b..d3fb832 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wgpu-matrix", - "version": "3.0.3", + "version": "3.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wgpu-matrix", - "version": "3.0.3", + "version": "3.1.0", "license": "MIT", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", diff --git a/package.json b/package.json index f0b26a0..d688327 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wgpu-matrix", - "version": "3.0.3", + "version": "3.1.0", "description": "fast matrix math library for WebGPU", "main": "dist/3.x/wgpu-matrix.module.js", "module": "dist/3.x/wgpu-matrix.module.js", diff --git a/src/mat3-impl.ts b/src/mat3-impl.ts index 4b1db03..40c935e 100644 --- a/src/mat3-impl.ts +++ b/src/mat3-impl.ts @@ -25,7 +25,9 @@ import { QuatArg } from './quat'; import { Mat3Arg, Mat3Type } from './mat3'; import { Mat4Arg } from './mat4'; import { Vec2Arg } from './vec2'; +import { Vec3Arg } from './vec3'; import { getAPI as getVec2API } from './vec2-impl'; +import { getAPI as getVec3API } from './vec3-impl'; import { BaseArgType } from './types'; export { Mat3Arg, Mat3Type }; @@ -37,6 +39,7 @@ type Mat3Ctor = new (n: number) => T; * */ function getAPIImpl(Ctor: Mat3Ctor) { const vec2 = getVec2API(Ctor); + const vec3 = getVec3API(Ctor); /** * Create a Mat3 from values @@ -502,11 +505,11 @@ function setAxis(m: Mat3Arg, v: Vec2Arg, axis: numb return newDst; } -///** -// * Returns the scaling component of the matrix -// * @param m - The Matrix -// * @param dst - The vector to set. If not passed a new one is created. -// */ +/** + * Returns the "2d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ function getScaling(m: Mat3Arg, dst?: T) { const newDst = (dst ?? vec2.create()); @@ -521,6 +524,32 @@ function getScaling(m: Mat3Arg, dst?: T) { return newDst; } + +/** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ +function get3DScaling(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? vec3.create()); + + const xx = m[0]; + const xy = m[1]; + const xz = m[2]; + const yx = m[4]; + const yy = m[5]; + const yz = m[6]; + const zx = m[8]; + const zy = m[9]; + const zz = m[10]; + + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + + return newDst; +} + /** * Creates a 3-by-3 matrix which translates by the given vector v. * @param v - The vector by which to translate. @@ -750,6 +779,7 @@ return { getAxis, setAxis, getScaling, + get3DScaling, translation, translate, rotation, diff --git a/src/mat4-impl.ts b/src/mat4-impl.ts index 6822b02..4d954b9 100644 --- a/src/mat4-impl.ts +++ b/src/mat4-impl.ts @@ -687,11 +687,11 @@ function setAxis(m: Mat4Arg, v: Vec3Arg, axis: numb return newDst; } -///** -// * Returns the scaling component of the matrix -// * @param m - The Matrix -// * @param dst - The vector to set. If not passed a new one is created. -// */ +/** + * Returns the "3d" scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ function getScaling(m: Mat4Arg, dst?: T) { const newDst = (dst ?? vec3.create()) as T; diff --git a/test/tests/mat3-test.js b/test/tests/mat3-test.js index a93df57..3ccde0c 100644 --- a/test/tests/mat3-test.js +++ b/test/tests/mat3-test.js @@ -70,6 +70,24 @@ function check(mat3, Type) { testV2WithDest(func, expected); } + function testV3WithoutDest(func, expected) { + const d = func(); + assertEqual(d, expected); + } + + function testV3WithDest(func, expected) { + const d = new Type(3).fill(0); + const c = func(d); + assertStrictEqual(c, d); + assertEqual(c, expected); + } + + function testVec3WithAndWithoutDest(func, expected) { + expected = createCopyOfType(expected); + testV3WithoutDest(func, expected); + testV3WithDest(func, expected); + } + it('should create', () => { const tests = [ {e: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], args: []}, @@ -365,6 +383,23 @@ function check(mat3, Type) { }, expected); }); + it('should get 3D scaling', () => { + const m = [ + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16, + ]; + const expected = [ + Math.sqrt(1 * 1 + 2 * 2 + 3 * 3), + Math.sqrt(5 * 5 + 6 * 6 + 7 * 7), + Math.sqrt(9 * 9 + 10 * 10 + 11 * 11), + ]; + testVec3WithAndWithoutDest((newDst) => { + return mat3.get3DScaling(m, newDst); + }, expected); + }); + it('should make translation matrix', () => { const expected = [ 1, 0, 0, 0, diff --git a/test/tests/mat4-test.js b/test/tests/mat4-test.js index ce79fbc..467875f 100644 --- a/test/tests/mat4-test.js +++ b/test/tests/mat4-test.js @@ -20,23 +20,24 @@ function check(mat4, Type) { 12, 13, 14, 15, ]; + function createCopyOfType(v) { + return Type === Array ? new Type(...v) : new Type(v); + } + function testMat4WithoutDest(func, expected, ...args) { const d = func(...args); assertEqualApproximately(d, expected); } function testMat4WithDest(func, expected, ...args) { - expected = new Float32Array(expected); - const d = new Float32Array(16); + expected = createCopyOfType(expected); + const d = new Type(16).fill(0); const c = func(...args, d); assertStrictEqual(c, d); assertEqualApproximately(c, expected); } function testMat4WithAndWithoutDest(func, expected, ...args) { - if (mat4.identity() instanceof Float32Array) { - //expected = new Float32Array(expected); - } testMat4WithoutDest(func, expected, ...args); testMat4WithDest(func, expected, ...args); } @@ -47,14 +48,14 @@ function check(mat4, Type) { } function testVec3WithDest(func, expected) { - const d = new Float32Array(3); + const d = new Type(3).fill(0); const c = func(d); assertStrictEqual(c, d); assertEqualApproximately(c, expected, 2e7); } function testVec3WithAndWithoutDest(func, expected) { - expected = new Float32Array(expected); + expected = createCopyOfType(expected); testVec3WithoutDest(func, expected); testVec3WithDest(func, expected); } @@ -361,7 +362,7 @@ function check(mat4, Type) { Math.sqrt(1 * 1 + 2 * 2 + 3 * 3), Math.sqrt(5 * 5 + 6 * 6 + 7 * 7), Math.sqrt(9 * 9 + 10 * 10 + 11 * 11), - ].map(v => new Type([v])[0]); + ]; testVec3WithAndWithoutDest((newDst) => { return mat4.getScaling(m, newDst); }, expected);